Skip to content

Instantly share code, notes, and snippets.

@MaxAnderson95
Last active July 23, 2023 01:08
Show Gist options
  • Save MaxAnderson95/deaa2abc5d8c8ea4bf85b0773b274965 to your computer and use it in GitHub Desktop.
Save MaxAnderson95/deaa2abc5d8c8ea4bf85b0773b274965 to your computer and use it in GitHub Desktop.

Ingress on K3d

  1. Create the cluster: k3d cluster create -p "8081:80@loadbalancer" --servers 3
  2. Deploy a web application kubectl create deployment nginx --image=nginx --replicas=3
  3. Expose the application as a service of type ClusterIP kubectl expose deployment/nginx --port 80 --name nginx
  4. Create an ingress object for the service:
kubectl apply -f - <<EOF
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: nginx-ingress
spec:
  rules:
  - http:
      paths:
      - pathType: Prefix
        path: "/"
        backend:
          service:
            name: nginx
            port:
              number: 80
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment