microk8s.enable ingress does not work when context namespace is not default

Created on 9 Jun 2019  路  9Comments  路  Source: ubuntu/microk8s

When I set my context namespace to a custom one and use microk8s.enable ingress, the ingress controller objects are created on my namespace.

But when that happens it does not work when I create my ingress. Instead of display 127.0.0.1 in the address field of kubectl get ingress, it shows blank and the address is not accessible.

inactive

Most helpful comment

I think microk8s.enable ingress should create the objects in a fixed namespace, not in the one defined in the current context.

All 9 comments

Oh yes. The service account nginx-ingress-microk8s-serviceaccount in the clusterrolebinding is bound to default namespace. You can try the crb manifest below.

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: nginx-ingress-microk8s
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: nginx-ingress-microk8s-clusterrole
subjects:
- kind: ServiceAccount
  name: nginx-ingress-microk8s-serviceaccount
  namespace: [your custom namespace]

I think fixing the ingress to be in an ingress namespace by default is a better approach. Wdyt?

I think microk8s.enable ingress should create the objects in a fixed namespace, not in the one defined in the current context.

@asfernandes yes. I meant the addon should consider using ingress namespace. 馃榿

I am +1 to using a fixed namespace for ingress (we could have that configurable with a sane default). Just to confirm we are discussing adding namespaces to the parts of the ingress manifest https://github.com/ubuntu/microk8s/blob/master/microk8s-resources/actions/ingress.yaml, right?

@ktsakalozos yup. That's the one.

We can work on this one after this pr? https://github.com/ubuntu/microk8s/pull/484

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This is fixed now. The ingress is now in ingress namespace.

Was this page helpful?
0 / 5 - 0 ratings