Add on: Ingress

This addon adds an NGINX Ingress Controller for MicroK8s. It is enabled by running the command:

  1. microk8s enable ingress

With the Ingress addon enabled, a HTTP/HTTPS ingress rule can be created with an Ingress resource. For example:

  1. apiVersion: networking.k8s.io/v1beta1
  2. kind: Ingress
  3. metadata:
  4. name: http-ingress
  5. spec:
  6. rules:
  7. - http:
  8. paths:
  9. - path: /
  10. backend:
  11. serviceName: some-service
  12. servicePort: 80

Additionally, the ingress addon can be configured to expose TCP and UDP services by editing the nginx-ingress-tcp-microk8s-conf and nginx-ingress-udp-microk8s-conf ConfigMaps respectively, and then exposing the port in the Ingress controller.

For example, here a Redis service is exposed via TCP:

  1. ---
  2. apiVersion: v1
  3. kind: ConfigMap
  4. metadata:
  5. name: nginx-ingress-tcp-microk8s-conf
  6. namespace: ingress
  7. data:
  8. 6379: "default/redis:6379"
  9. ---
  10. apiVersion: apps/v1
  11. kind: DaemonSet
  12. metadata:
  13. name: nginx-ingress-microk8s-controller
  14. namespace: ingress
  15. spec:
  16. template:
  17. spec:
  18. containers:
  19. - name: nginx-ingress-microk8s
  20. ports:
  21. - containerPort: 80
  22. - containerPort: 443
  23. - name: proxied-tcp-6379
  24. containerPort: 6379
  25. hostPort: 6379
  26. protocol: TCP

Last updated 7 months ago. Help improve this document in the forum.