kubernetes ingress on digitalocean: the ultimate setup guide you can’t afford to miss

what is kubernetes ingress and why it matters for devops

when diving into the world of devops and container orchestration, understanding kubernetes ingress is a game-changer. ingress acts as a gateway to your kubernetes cluster, allowing external traffic to reach your services in a controlled and efficient way.

for full stack developers and engineers, ingress isn't just a networking tool—it's a critical piece in delivering scalable, secure, and maintainable applications. whether you're deploying a frontend react app or a backend api, ingress helps you manage routing rules, ssl termination, and path-based access—without exposing every service directly to the internet.

why choose digitalocean for kubernetes?

digitalocean offers a simple, intuitive kubernetes experience that's perfect for beginners and seasoned developers alike. its managed kubernetes service (doks) reduces the complexity of setting up clusters, making it ideal for students and coders who want to focus on building instead of infrastructure maintenance.

with built-in integrations, affordable pricing, and seamless domain management, digitalocean is a strong choice for anyone practicing coding projects or learning devops workflows.

prerequisites for setting up ingress on digitalocean

before we begin, make sure you have the following:

  • a digitalocean account with billing enabled
  • kubectl installed locally (kubectl version --client)
  • doctl cli installed and authenticated (doctl auth init)
  • a domain name (or subdomain) pointing to your digitalocean load balancer
  • a running kubernetes cluster on digitalocean

step 1: create a kubernetes cluster on digitalocean

navigate to the digitalocean control panel and click “create” > “kubernetes”. choose a cluster name, region, and node pool size (start with the smallest if you're learning).

once your cluster is active, download the kubeconfig file:

doctl kubernetes cluster kubeconfig save your-cluster-name

verify access with:

kubectl get nodes

you should see your nodes listed as ready.

step 2: deploy a sample application

let’s deploy a simple nginx app to test our ingress setup.

create a file called nginx-deployment.yaml:

apiversion: apps/v1
kind: deployment
metadata:
  name: nginx-deployment
spec:
  replicas: 2
  selector:
    matchlabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:latest
        ports:
        - containerport: 80
---
apiversion: v1
kind: service
metadata:
  name: nginx-service
spec:
  selector:
    app: nginx
  ports:
    - protocol: tcp
      port: 80
      targetport: 80

apply it:

kubectl apply -f nginx-deployment.yaml

verify it's running:

kubectl get pods,services

step 3: install the nginx ingress controller

digitalocean recommends using the official nginx ingress controller. install it using helm for easier management:

helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
helm install ingress-nginx ingress-nginx/ingress-nginx

this command deploys the ingress controller and creates a loadbalancer service. wait a moment and check:

kubectl get service ingress-nginx-controller

you’ll see an external ip assigned—this is your ingress endpoint.

step 4: configure dns on digitalocean

log in to your digitalocean dashboard and go to networking > domains.

create a new domain or select an existing one. add an a record pointing to the external ip from the previous step:

  • hostname: * or example.yourdomain.com
  • will direct to: [your ingress ip]
  • type: a

this wildcard or specific record ensures all subdomains route correctly through ingress.

step 5: create an ingress resource

now define how traffic should be routed. create ingress.yaml:

apiversion: networking.k8s.io/v1
kind: ingress
metadata:
  name: app-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  rules:
  - host: example.yourdomain.com
    http:
      paths:
      - path: /
        pathtype: prefix
        backend:
          service:
            name: nginx-service
            port:
              number: 80

apply it:

kubectl apply -f ingress.yaml

visit http://example.yourdomain.com in your browser—you should see the nginx welcome page!

adding ssl with let's encrypt (bonus for seo & security)

secure your app using tls. install cert-manager to automate ssl with let's encrypt:

helm repo add jetstack https://charts.jetstack.io
helm repo update
helm install \
  cert-manager jetstack/cert-manager \
  --namespace cert-manager \
  --create-namespace \
  --version v1.12.0 \
  --set installcrds=true

then create a clusterissuer for let's encrypt:

apiversion: cert-manager.io/v1
kind: clusterissuer
metadata:
  name: letsencrypt-prod
spec:
  acme:
    server: https://acme-v02.api.letsencrypt.org/directory
    email: [email protected]
    privatekeysecretref:
      name: letsencrypt-prod
    solvers:
    - http01:
        ingress:
          class: nginx

update your ingress to request https:

apiversion: networking.k8s.io/v1
kind: ingress
metadata:
  name: app-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
    cert-manager.io/cluster-issuer: "letsencrypt-prod"
spec:
  tls:
  - hosts:
      - example.yourdomain.com
    secretname: example-tls
  rules:
  - host: example.yourdomain.com
    http:
      paths:
      - path: /
        pathtype: prefix
        backend:
          service:
            name: nginx-service
            port:
              number: 80

troubleshooting common ingress issues

  • ingress ip pending? wait a few minutes—digitalocean may take time to assign the load balancer ip.
  • 503 service unavailable? double-check that your service name and port in the ingress exactly match the deployed service.
  • ssl not working? verify your domain dns and ensure the email in clusterissuer is valid.
  • use kubectl describe ingress app-ingress and kubectl logs on ingress controller pods to debug.

final thoughts: mastering devops one step at a time

setting up kubernetes ingress on digitalocean is a powerful skill that bridges coding and real-world deployment. whether you're a student building your portfolio or a full stack engineer scaling an app, this setup enhances your seo strategy by ensuring your sites are secure, fast, and accessible.

remember: every expert was once a beginner. keep experimenting, break things, and rebuild. that’s how real devops mastery happens.

pro tip: document your journey. writing blogs about your kubernetes setup not only improves your learning but boosts your visibility—great for personal seo and showcasing your skills!

Comments

Discussion

Share your thoughts and join the conversation

Loading comments...

Join the Discussion

Please log in to share your thoughts and engage with the community.