# Addon: Ingress

**URL:** <https://discuss.kubernetes.io/t/addon-ingress/11259>\
**Category:** microk8s\
**Tags:** docs\
**Created:** [June 4, 2020, 3:07pm UTC](https://discuss.kubernetes.io/t/addon-ingress/11259 "2020-06-04T15:07:29Z")\
**Posts on this page:** 19\
**Page:** 2

<div class="post-metadata">

**Author:** ![zambal](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/zambal/32/7478_2.png) [@zambal](https://discuss.kubernetes.io/u/zambal)\
**Post date:** [April 24, 2021, 12:24pm UTC](https://discuss.kubernetes.io/t/addon-ingress/11259/22 "2021-04-24T12:24:27Z")

</div>

Being pretty new to microk8s and kubernetes in general, it also took me hours to get cert-manager working with microk8s because I had to change the class name to public.

I think it would be good if the microk8s docs would mention this clearly.

---

<div class="post-metadata">

**Author:** ![monky](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@monky](https://discuss.kubernetes.io/u/monky)\
**Post date:** [September 4, 2021, 11:58pm UTC](https://discuss.kubernetes.io/t/addon-ingress/11259/24 "2021-09-04T23:58:02Z")

</div>

Trying to expose 4001/TCP+UDP does not seem to work. Can only choose one of them.

```auto
    spec:
      containers:
        - name: nginx-ingress-microk8s
          image: 'k8s.gcr.io/ingress-nginx/controller:v0.44.0'
          args:
            - /nginx-ingress-controller
            - '--configmap=$(POD_NAMESPACE)/nginx-load-balancer-microk8s-conf'
            - >-
              --tcp-services-configmap=$(POD_NAMESPACE)/nginx-ingress-tcp-microk8s-conf
            - >-
              --udp-services-configmap=$(POD_NAMESPACE)/nginx-ingress-udp-microk8s-conf
            - '--ingress-class=public'
            - ' '
            - '--publish-status-address=127.0.0.1'
          ports:
            - name: http
              hostPort: 80
              containerPort: 80
              protocol: TCP
            - name: https
              hostPort: 443
              containerPort: 443
              protocol: TCP
            - name: prox-tcp-4001
              hostPort: 4001
              containerPort: 4001
              protocol: TCP
            - name: prox-udp-4001
              hostPort: 4001
              containerPort: 4001
              protocol: UDP

```

Once I apply these changes, the DaemonSet seems to accept it. But removes the UDP section internally from the config. Same, when I add the UDP section first, then TCP is removed.

How to expose both TCP+UDP for the same port?

---

<div class="post-metadata">

**Author:** ![evilnick](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/evilnick/32/3481_2.png) [@evilnick](https://discuss.kubernetes.io/u/evilnick)\
**Post date:** [September 9, 2021, 9:37am UTC](https://discuss.kubernetes.io/t/addon-ingress/11259/25 "2021-09-09T09:37:49Z")

</div>

@monky, you may have hit this kubernetes bug:

> <https://github.com/kubernetes/kubernetes/issues/39188>
>
> User reported:
> 
> I am running a service with both TCP and UDP:
> 
> \`\`\`
> spec:
> … type: NodePort
> ports:
> - protocol: UDP
> port: 30420
> nodePort: 30420
> - protocol: TCP
> port: 30420
> nodePort: 30420
> \`\`\`
> 
> but kubectl describe service shows only UDP.
> 
> \`\`\`
> Type: NodePort
> IP: 10.0.13.152
> Port: \<unset\>	30420/UDP
> NodePort: \<unset\>	30420/UDP
> Endpoints: 10.244.4.49:30420
> \`\`\`
> 
> When I change the order then it shows only TCP.
> 
> This looks like using the wrong mergeKey, and indeed the code backs that up:
> 
> 2508 type ServiceSpec struct {
> 2509 // The list of ports that are exposed by this service.
> 2510 // More info: http://kubernetes.io/docs/user-guide/services#virtual-ips-and-service-proxies
> 2511 Ports \[\]ServicePort \`json:"ports,omitempty" patchStrategy:"merge" patchMergeKey:"port" protobuf:"bytes,1,rep,name=ports"\`  
> 
> The key should probably be "name", though that can be empty if there is a single port only - is that a problem? @ymqytw ?

If you want both to work, they have to be created that way, updates will only give you one or the other because of the way key merging works

---

<div class="post-metadata">

**Author:** ![davidberglund](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/davidberglund/32/8539_2.png) [@davidberglund](https://discuss.kubernetes.io/u/davidberglund)\
**Post date:** [September 14, 2021, 11:23am UTC](https://discuss.kubernetes.io/t/addon-ingress/11259/26 "2021-09-14T11:23:52Z")

</div>

Hey, the Ingress docs page should reference the Metallb docs explaining how to set up Ingress with Metallb IPs. It took my a while and some help on Slack to figure this out. I noticed no svc of type loadbalancer was created so I tried to define the svc myself. It’s not obvious and shouldn’t be expected that you check Metallb docs page to find out how to have ingress-nginx add on use a load balancer.

Text suggestion:  
“To use Ingress with a load balancer, [see Metallb docs](https://microk8s.io/docs/addon-metallb).”

---

<div class="post-metadata">

**Author:** ![Nathan\_Sowatskey](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/nathan_sowatskey/32/8955_2.png) [@Nathan\_Sowatskey](https://discuss.kubernetes.io/u/Nathan_Sowatskey)\
**Post date:** [November 17, 2021, 3:01pm UTC](https://discuss.kubernetes.io/t/addon-ingress/11259/27 "2021-11-17T15:01:25Z")

</div>

After using the command `microk8s enable ingress`, I then wanted to check whether that had worked. I used the following commands to check:

```auto
$ k get pod -A | grep nginx
ingress nginx-ingress-microk8s-controller-wfg66 1/1 Running 0 29s

```

This shows me a pod, which is good.

```auto
$ k get svc -A 
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default kubernetes ClusterIP 10.152.183.1 <none> 443/TCP 5m11s

```

This did _not_ show me a service, which is confusing in comparison to the Helm install method, shown below.

By contrast, I also used:

```auto
helm upgrade --install ingress-nginx ingress-nginx \
  --repo https://kubernetes.github.io/ingress-nginx \
  --namespace ingress-nginx --create-namespace

```

From which I saw:

```auto
 k get svc -A 
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default kubernetes ClusterIP 10.152.183.1 <none> 443/TCP 14m
ingress-nginx ingress-nginx-controller-admission ClusterIP 10.152.183.27 <none> 443/TCP 2m43s
ingress-nginx ingress-nginx-controller LoadBalancer 10.152.183.2 <pending> 80:30704/TCP,443:31906/TCP 2m43s
$ k get pod -A 
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system calico-node-hmfm9 1/1 Running 0 14m
kube-system calico-kube-controllers-f6b5877b8-qxplq 1/1 Running 0 14m
ingress-nginx ingress-nginx-controller-77f4468d76-c9j5h 1/1 Running 0 2m52s

```

The _apparent_ discrepancy with the `k svc -A` output led me to doubt whether the `microk8s enable ingress` had in fact worked as expected.

I would like to suggest that the documentation be enhanced with commands that can be used to show that the nginx ingress controller is properly installed. Additionally, some indication of why the different install techniques seem to result in different outcomes would help.

Many thanks

Nathan

---

<div class="post-metadata">

**Author:** ![Nathan\_Sowatskey](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/nathan_sowatskey/32/8955_2.png) [@Nathan\_Sowatskey](https://discuss.kubernetes.io/u/Nathan_Sowatskey)\
**Post date:** [November 22, 2021, 6:41am UTC](https://discuss.kubernetes.io/t/addon-ingress/11259/28 "2021-11-22T06:41:08Z")

</div>

With respect to the default value of `ingressClass=public`, also see: [#253 - nginx ingress microk8s - ` Service "default/gitea-http" does not have any active Endpoint.` - helm-chart - Gitea: Git with a cup of tea](https://gitea.com/gitea/helm-chart/issues/253) and [kubernetes - Simple ingress from host with microk8s? - Stack Overflow](https://stackoverflow.com/questions/54506269/simple-ingress-from-host-with-microk8s/67041204#67041204)

What would be good is a very explicit mention of this unexpected change, and also a means to set the ingressClass=nginx on the CLI, for example something like `microk8s enable ingress:ingressClass=nginx`.

---

<div class="post-metadata">

**Author:** ![Nathan\_Sowatskey](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/nathan_sowatskey/32/8955_2.png) [@Nathan\_Sowatskey](https://discuss.kubernetes.io/u/Nathan_Sowatskey)\
**Post date:** [November 22, 2021, 8:04am UTC](https://discuss.kubernetes.io/t/addon-ingress/11259/29 "2021-11-22T08:04:41Z")

</div>

To install nginx such that it works with the `ingressClass=nginx` use:

```auto
#https://kubernetes.github.io/ingress-nginx/deploy/
helm upgrade --install ingress-nginx ingress-nginx \
  --repo https://kubernetes.github.io/ingress-nginx \
  --namespace ingress-nginx --create-namespace

```

---

<div class="post-metadata">

**Author:** ![sed-i](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/sed-i/32/9026_2.png) [@sed-i](https://discuss.kubernetes.io/u/sed-i)\
**Post date:** [November 25, 2021, 10:17pm UTC](https://discuss.kubernetes.io/t/addon-ingress/11259/30 "2021-11-25T22:17:50Z")

</div>

I would add to the doc something along the lines of:

You can confirm the addon is ready using:  
`sh -c "until microk8s.kubectl rollout status daemonsets/nginx-ingress-microk8s-controller -n ingress -w; do sleep 5; done"`

---

<div class="post-metadata">

**Author:** ![xieu90](https://avatars.discourse-cdn.com/v4/letter/x/e19adc/32.png) [@xieu90](https://discuss.kubernetes.io/u/xieu90)\
**Post date:** [December 5, 2021, 11:42am UTC](https://discuss.kubernetes.io/t/addon-ingress/11259/31 "2021-12-05T11:42:06Z")

</div>

hi, i have created a wordpress using this command  
microk8s helm3 install wordpressnodeport bitnami/wordpress --set service.type=NodePort  
after that i can access it via [https://localhost:32284/](https://localhost:32284/)  
\*attachment top image

then i enabled ingress via  
microk8s enable ingress

then create a yaml like this:

```auto
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  namespace: default
  annotations:
    nginx.ingress.kubernetes.io/backend-protocol: HTTPS
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/configuration-snippet: |-
      proxy_ssl_server_name on;
      proxy_ssl_name $host;
  name: wordpressnodeport
spec:
  ingressClassName: public
  rules:
  - host: wordpressnodeport.localhost
  - http:
      paths:
      - path: /*
        pathType: Prefix
        backend:
          service:
            name: wordpressnodeport
            port:
              number: 443
  

```

and applied it:  
microk8s kubectl apply -f ingress-controller-wordpressnodeport.yaml

now when i try to access [https://localhost/wordpressnodeport](https://localhost/wordpressnodeport), it can access but seems like resources aren’t loaded

\*attachment bottom image

 ![png](https://us1.discourse-cdn.com/flex016/uploads/kubernetes/original/2X/1/15da06e2626e1ca5769f7e1a50af74bb177c4cad.png)

any idea what could be wrong in my case?

solution: i used the example in this link [networking - How to enable default-http-backend in Kubernetes in order to make Ingress work? - Stack Overflow](https://stackoverflow.com/questions/64009726/how-to-enable-default-http-backend-in-kubernetes-in-order-to-make-ingress-work)  
and managed to fix the problem, now it works [https://wordpressnodeport.localhost](https://wordpressnodeport.localhost) also for a second page [https://wordpress2.localhost](https://wordpress2.localhost)  
example for wordpressnodeport in case anyone got similar problem like me:

```auto
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  defaultBackend:
    service:
      name: wordpressnodeport
      port:
        number: 80
  rules:
    - host: wordpressnodeport.localhost
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: wordpressnodeport
                port:
                  number: 80

```

for wordpress2, just replace wordpressnodeport with wordpress2. and replace name:ingress to wordpress2  
example  
metadata:  
name: wordpress2

so one can spam as much controllers as one wish i think.  
using  
microk8s kubectl describe ingress  
I get a lot of old configuration, anyone knows how to delete it? or how to get the original yaml when they are created?

---

<div class="post-metadata">

**Author:** ![NanoSector](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/nanosector/32/9595_2.png) [@NanoSector](https://discuss.kubernetes.io/u/NanoSector)\
**Post date:** [February 28, 2022, 9:53am UTC](https://discuss.kubernetes.io/t/addon-ingress/11259/32 "2022-02-28T09:53:32Z")

</div>

As a new and inexperienced Kubernetes user, I was stumped to find that there was not an Nginx Ingress pod running. A mention of the `ingress` namespace would be nice along with maybe an example on how to troubleshoot the instance (`microk8s kubectl logs -n ingress [pod name here]`). Looking through the discussion here I am not the only person who was confused by this.

If I’m being honest, this page as a whole was not useful in the slightest to me beyond the installation command, as it just dumps a block of code in front of you with “this is how you can create an Ingress”. I was still clueless at that point. Pointers to at least the Kubernetes documentation would have been helpful, or a description of what this block achieves. Also, how do I edit those config maps? Why would I do this over creating a rule?

---

<div class="post-metadata">

**Author:** ![tphk](https://avatars.discourse-cdn.com/v4/letter/t/9dc877/32.png) [@tphk](https://discuss.kubernetes.io/u/tphk)\
**Post date:** [April 29, 2022, 9:25am UTC](https://discuss.kubernetes.io/t/addon-ingress/11259/33 "2022-04-29T09:25:51Z")

</div>

Hello! I recently formed a microk8s cluster with 3 ubuntu nodes + 2 windows 2019 nodes. It seems that everything is working great and up and running. Also, thanks for @balchua1 's help on the nodeselector for different OS. However, I just found out that the microk8s addon ingress auto-scheduled 5 pods on each node. But those 2 pods on Windows are not working and are under ‘ContainerCreating’. Any chance I could custom make an enhancement on this? Thanks!

NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE  
daemonset.apps/nginx-ingress-microk8s-controller 5 5 3 5 3 102m

NAME READY STATUS RESTARTS AGE  
pod/nginx-ingress-microk8s-controller-zpk5g 0/1 ContainerCreating 0 102m  
pod/nginx-ingress-microk8s-controller-tsr7n 1/1 Running 0 102m  
pod/nginx-ingress-microk8s-controller-9rpxz 1/1 Running 0 99m  
pod/nginx-ingress-microk8s-controller-tdr2q 1/1 Running 0 89m  
pod/nginx-ingress-microk8s-controller-ck2hp 0/1 ContainerCreating 0 68m

---

<div class="post-metadata">

**Author:** ![balchua1](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/balchua1/32/5372_2.png) [@balchua1](https://discuss.kubernetes.io/u/balchua1)\
**Post date:** [April 29, 2022, 11:23am UTC](https://discuss.kubernetes.io/t/addon-ingress/11259/34 "2022-04-29T11:23:02Z")

</div>

Yes definitely. PRs are welcome.  
Microk8s team has now split the addons to a different repo.

The ingress addon is part of the [core addons](https://github.com/canonical/microk8s-core-addons)

---

<div class="post-metadata">

**Author:** ![tphk](https://avatars.discourse-cdn.com/v4/letter/t/9dc877/32.png) [@tphk](https://discuss.kubernetes.io/u/tphk)\
**Post date:** [May 5, 2022, 6:59am UTC](https://discuss.kubernetes.io/t/addon-ingress/11259/35 "2022-05-05T06:59:06Z")

</div>

Thank you and I will try this out soon.

---

<div class="post-metadata">

**Author:** ![mcordova1967](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/mcordova1967/32/11743_2.png) [@mcordova1967](https://discuss.kubernetes.io/u/mcordova1967)\
**Post date:** [March 29, 2023, 1:59pm UTC](https://discuss.kubernetes.io/t/addon-ingress/11259/36 "2023-03-29T13:59:34Z")

</div>

Indeed! it’s very basic information that would be nice to have on the Add-On documentation page.

---

<div class="post-metadata">

**Author:** ![jepson](https://avatars.discourse-cdn.com/v4/letter/j/da6949/32.png) [@jepson](https://discuss.kubernetes.io/u/jepson)\
**Post date:** [July 9, 2023, 2:34am UTC](https://discuss.kubernetes.io/t/addon-ingress/11259/37 "2023-07-09T02:34:38Z")

</div>

and microk8s enable ingress,pod status is ImagePullBackOff,I found out that I cannot access [registry.k8s.io/ingress-nginx/controller](http://registry.k8s.io/ingress-nginx/controller), but I can access [Google Cloud console](http://k8s.gcr.io/ingress-nginx/controller). How to solve this? Can I modify the configuration file of ingress? Where can I modify

---

<div class="post-metadata">

**Author:** ![nguyenphu123](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/nguyenphu123/32/15408_2.png) [@nguyenphu123](https://discuss.kubernetes.io/u/nguyenphu123)\
**Post date:** [July 22, 2024, 3:09am UTC](https://discuss.kubernetes.io/t/addon-ingress/11259/38 "2024-07-22T03:09:30Z")

</div>

Can I use this but with nginx plus instead of the open source ?

---

<div class="post-metadata">

**Author:** ![evilnick](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/evilnick/32/3481_2.png) [@evilnick](https://discuss.kubernetes.io/u/evilnick)\
**Post date:** [July 22, 2024, 4:38pm UTC](https://discuss.kubernetes.io/t/addon-ingress/11259/39 "2024-07-22T16:38:34Z")

</div>

@nguyenphu123 possibly. You would have to build your own add-on and call it something different, then replace whatever images and settings you needed from

> <https://github.com/canonical/microk8s-core-addons/blob/main/addons/ingress/ingress.yaml>

---

<div class="post-metadata">

**Author:** ![nguyenphu123](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/nguyenphu123/32/15408_2.png) [@nguyenphu123](https://discuss.kubernetes.io/u/nguyenphu123)\
**Post date:** [July 23, 2024, 2:45am UTC](https://discuss.kubernetes.io/t/addon-ingress/11259/40 "2024-07-23T02:45:21Z")

</div>

Thanks for the reply, I have tried this and it seem working good. Now I just need to figure out how the pod can pull image from private registry instead of public.

---

<div class="post-metadata">

**Author:** ![nguyenphu123](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/nguyenphu123/32/15408_2.png) [@nguyenphu123](https://discuss.kubernetes.io/u/nguyenphu123)\
**Post date:** [July 25, 2024, 4:06am UTC](https://discuss.kubernetes.io/t/addon-ingress/11259/41 "2024-07-25T04:06:27Z")

</div>

Hi, do you have any example for nginx-ingress configmap, I tried to change the nginx.conf via edit nginx-config.yaml but it not applied.  
Here is my nginx-config.yaml file:

```auto
kind: ConfigMap
apiVersion: v1
metadata:
  name: nginx-conf
  namespace: nginx-ingress
data:
   nginx.conf: | #my nginx.conf configs are here

```

Here is my nginx-plus-ingress.yaml file:

```auto
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-ingress
  namespace: nginx-ingress
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx-ingress
  template:
    metadata:
      labels:
        app: nginx-ingress
        app.kubernetes.io/name: nginx-ingress
     #annotations:
       #prometheus.io/scrape: "true"
       #prometheus.io/port: "9113"
       #prometheus.io/scheme: http
    spec:
      serviceAccountName: nginx-ingress
      automountServiceAccountToken: true
      securityContext:
        seccompProfile:
          type: RuntimeDefault
      volumes:
      - name: nginx-conf
        configMap:
          name: nginx-conf
          items:
          - key: nginx.conf
            path: nginx.conf
# - name: nginx-etc
# emptyDir: {}
# - name: nginx-cache
# emptyDir : {}
# - name: nginx-lib
# emptyDir: {}
# - name: nginx-log
# emptyDir: {}
      containers:
      - image: my nginx plus image
        imagePullPolicy: IfNotPresent
        name: nginx-ingress
        ports:
        - name: http
          containerPort: 8082
        - name: https
          containerPort: 443
        - name: readiness-port
          containerPort: 8081
        - name: prometheus
          containerPort: 9113
        - name: service-insight
          containerPort: 9114
        readinessProbe:
          httpGet:
            path: /nginx-ready
            port: readiness-port
          periodSeconds: 1
        resources:
          requests:
            cpu: "100m"
            memory: "128Mi"
         #limits:
         # cpu: "1"
         # memory: "1Gi"
        securityContext:
          allowPrivilegeEscalation: false
# readOnlyRootFilesystem: true
          runAsUser: 101 #nginx
          runAsNonRoot: true
          capabilities:
            drop:
            - ALL
            add:
            - NET_BIND_SERVICE
# volumeMounts:
# - mountPath: /etc/nginx
# readOnly: false
# name: nginx-conf
        # subPath: nginx.conf
# name: nginx-etc
# - mountPath: /var/cache/nginx
# name: nginx-cache
# - mountPath: /var/lib/nginx
# name: nginx-lib
# - mountPath: /var/log/nginx
# name: nginx-log
        env:
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        args:
          - -nginx-plus
          - -nginx-configmaps=$(POD_NAMESPACE)/nginx-conf
          - -report-ingress-status
          - -external-service=nginx-ingress
         #- -default-server-tls-secret=$(POD_NAMESPACE)/default-server-secret
         #- -enable-cert-manager
         #- -enable-external-dns
         #- -enable-app-protect
         #- -enable-app-protect-dos
         #- -v=3 # Enables extensive logging. Useful for troubleshooting.
         #- -enable-prometheus-metrics
         #- -enable-service-insight
         #- -global-configuration=$(POD_NAMESPACE)/nginx-config
# initContainers:
# - image: my nginx image
# imagePullPolicy: IfNotPresent
# name: init-nginx-ingress
# command: ['cp', '-vdR', '/etc/nginx/.', '/mnt/etc']
# securityContext:
# allowPrivilegeEscalation: false
# readOnlyRootFilesystem: true
# runAsUser: 101 #nginx
# runAsNonRoot: true
# capabilities:
# drop:
# - ALL
# volumeMounts:
# - mountPath: /mnt/etc
# name: nginx-etc

```

[Previous page](https://discuss.kubernetes.io/t/addon-ingress/11259.md?page=1)
