Report this

What is the reason for this report?

How do I setup an ingress on digitalocean kubernetes

Posted on November 4, 2018

I’ve been trying out the new kubernetes product by DO and so far it’s going great. While I can create LoadBalancer services, I don’t seem to be able to create an ingress. My config:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: loadbalancer-https
spec:
  tls:
    - hosts:
        - demo1.example.com
      secretName: ssl-example-com
  rules:
    - host: demo1.example.com
      http:
        paths:
          - path: /admin
            backend:
              serviceName: admin
              servicePort: 3000
          - path: /user
            backend:
              serviceName: user
              servicePort: 3001
          - path: /
            backend:
              serviceName: root
              servicePort: 80

The ssl secret is already deployed to the cluster (and the actual hostname has been replaced with ‘example’ here). I’ve also tried without ssl and also tried with kubernetes.io/ingress.class: "nginx" meta tag. Neither seemed to work. Am I missing something?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Your cluster requires an Ingress Controller to route traffic from a Load-Balancer to a Service.

The flow of traffic is like this:

(internet) -> LoadBalancer -> [ Ingress Controller -> Service]

You can deploy an ingress controller like nginx by following this: https://kubernetes.github.io/ingress-nginx/deploy/

The generic steps worked for me:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/mandatory.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/cloud-generic.yaml

The verification steps from the doc checked out, and I can see the load balancer the process created in the do dashboard.

You can probably do the same with a single step via the Helm installation (also documented on the nginx-ingress/deploy page). That’s how we deploy it at work (on an ACS cluster in Azure).

You might need to install an ingress server like nginx-ingress: https://kubernetes.github.io/ingress-nginx/deploy/

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.