Add on: Ambassador

Ambassador is available on the latest and 1.19+ tracks.

Ambassador API Gateway enables you to easily expose, secure, and manage traffic to your Kubernetes microservices of any type. Enable this add on with:

  1. microk8s enable ambassador

You can now expose a Service by creating an Ingress . Note that Ambassador will only serve Ingress resources that include the annotation kubernetes.io/ingress.class: ambassador (otherwise they are just ignored).

For example:

  1. cat<<EOF | microk8s.kubectl apply -f -
  2. ---
  3. kind: Pod
  4. apiVersion: v1
  5. metadata:
  6. name: foo-app
  7. labels:
  8. app: foo
  9. spec:
  10. containers:
  11. - name: foo-app
  12. image: hashicorp/http-echo:0.2.3
  13. args:
  14. - "-text=foo"
  15. ---
  16. kind: Service
  17. apiVersion: v1
  18. metadata:
  19. name: foo-service
  20. spec:
  21. selector:
  22. app: foo
  23. ports:
  24. # Default port used by the image
  25. - port: 5678
  26. ---
  27. apiVersion: extensions/v1beta1
  28. kind: Ingress
  29. metadata:
  30. name: example-ingress
  31. annotations:
  32. kubernetes.io/ingress.class: ambassador
  33. spec:
  34. rules:
  35. - http:
  36. paths:
  37. - path: /foo
  38. backend:
  39. serviceName: foo-service
  40. servicePort: 5678
  41. EOF

Now verify that the ingress works:

  1. # should output "foo"
  2. curl localhost/foo

Last updated 1 year, 1 month ago. Help improve this document in the forum.