How to deploy on Kubernetes
This example shows how to deploy to Kubernetes using the base opentopodata docker image. It includes a workload (ingress.yml) configuration and a service (service.yml) configuration which is used to access the opentopodata API by routing queries to the container.
You need access to a K8s cluster and in this example we are using the command-line-interface
kubectl to deploy. For instructions on how to do that visit the K8s website.
Assuming you have a domain,
subdomain.example.com where you want to make the opentopodata available on the endpoint
subdomain.example.com/dem-api/, the files deployment.yml, ingress.yml and service.yml shows how to set that up. It works out of the box with the base opentopodata docker image.
Simply run these commands:
apiVersion: extensions/v1beta1 kind: Ingress metadata: name: dem-api annotations: nginx.ingress.kubernetes.io/rewrite-target: /$1 nginx.ingress.kubernetes.io/ssl-redirect: "false" spec: rules: - host: subdomain.example.com http: paths: - path: /dem-api/(.*) backend: serviceName: dem-api servicePort: 5000