Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting as default ingress class #1221

Closed
mofm opened this issue Nov 6, 2020 · 14 comments
Closed

Setting as default ingress class #1221

mofm opened this issue Nov 6, 2020 · 14 comments

Comments

@mofm
Copy link

mofm commented Nov 6, 2020

Describe the bug
Although I installed nginx-ingress as default ingress, doesn't create ingress without adding ingress class annotation (kubernetes.io/ingress.class: "nginx")
Cluster have only one ingress and ingress class. No multi ingress.

To Reproduce
Steps to reproduce the behavior:

  1. Bare Metal k8s cluster ( Rancher 2.4.8 ) with Metallb.
  2. Deploy ingress controller using helm chart. ( helm 3 )

$ helm install my-ingress03 nginx-stable/nginx-ingress --set controller.kind=daemonset --set controller.service.type=LoadBalancer --set rbac.create=true --set controller.setAsDefaultIngress=true -n nginx-ingress

  1. Deploy a test ingress and ingress stuck in initializing

$ kubectl get ingress

NAME        CLASS    HOSTS    ADDRESS   PORTS   AGE
hello-ingress     <none>   hello-ingress.test.local             80      18s

But it works when i deploy as below ( added annotations: kubernetes.io/ingress.class: "nginx" )

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: hello-ingress
  annotations:
    kubernetes.io/ingress.class: "nginx"
spec:
  rules:
  - host: "hello-ingress.test.local"
    http:
      paths:
      - path: /
        backend:
          serviceName: web
          servicePort: 8080

Expected behavior
create ingresses successfully without adding ingress class annotations (kubernetes.io/ingress.class: "nginx") [ controller.setAsDefaultIngress=true]

Your environment

  • Version of the Ingress Controller - release version or a specific commit

$ kubectl get pods -n nginx-ingress

NAME                               READY   STATUS    RESTARTS   AGE
my-ingress03-nginx-ingress-cr5k7   1/1     Running   0          21h
my-ingress03-nginx-ingress-pckfh   1/1     Running   0          21h

$ kubectl describe pod my-ingress03-nginx-ingress-cr5k7 -n nginx-ingress

Name:         my-ingress03-nginx-ingress-cr5k7
Namespace:    nginx-ingress
Priority:     0
Node:         k8s-node01/172.21.0.3
Start Time:   Fri, 06 Nov 2020 03:06:43 +0300
Labels:       app=my-ingress03-nginx-ingress
              controller-revision-hash=5f5b9559d9
              field.cattle.io/podName=my-ingress03-nginx-ingress-cr5k7
              pod-template-generation=1
Annotations:  cni.projectcalico.org/podIP: 10.42.1.52/32
              cni.projectcalico.org/podIPs: 10.42.1.52/32
              kubernetes.io/psp: default-psp
              prometheus.io/port: 9113
              prometheus.io/scrape: true
Status:       Running
IP:           10.42.1.52
IPs:
  IP:           10.42.1.52
Controlled By:  DaemonSet/my-ingress03-nginx-ingress
Containers:
  my-ingress03-nginx-ingress:
    Container ID:  docker://3bcd2089dd1d69298efe6b43726af2e157ebbaa12c9ed15624697ca358a4d08c
    Image:         nginx/nginx-ingress:1.9.0
    Image ID:      docker-pullable://nginx/nginx-ingress@sha256:ad84fede7e790dc93d0d44c3fe35dda1e70f299e5094f0ada726b344bac9c587
    Ports:         80/TCP, 443/TCP, 9113/TCP, 8081/TCP
    Host Ports:    80/TCP, 443/TCP, 0/TCP, 0/TCP
    Args:
      -nginx-plus=false
      -nginx-reload-timeout=0
      -enable-app-protect=false
      -nginx-configmaps=$(POD_NAMESPACE)/my-ingress03-nginx-ingress
      -default-server-tls-secret=$(POD_NAMESPACE)/my-ingress03-nginx-ingress-default-server-secret
      -ingress-class=nginx
      -health-status=false
      -health-status-uri=/nginx-health
      -nginx-debug=false
      -v=1
      -nginx-status=true
      -nginx-status-port=8080
      -nginx-status-allow-cidrs=127.0.0.1
      -report-ingress-status
      -external-service=my-ingress03-nginx-ingress
      -enable-leader-election=true
      -leader-election-lock-name=my-ingress03-nginx-ingress-leader-election
      -enable-prometheus-metrics=true
      -prometheus-metrics-listen-port=9113
      -enable-custom-resources=true
      -enable-tls-passthrough=false
      -enable-snippets=false
      -ready-status=true
      -ready-status-port=8081
      -enable-latency-metrics=false
    State:          Running
      Started:      Fri, 06 Nov 2020 03:06:48 +0300
    Ready:          True
    Restart Count:  0
    Readiness:      http-get http://:readiness-port/nginx-ready delay=0s timeout=1s period=1s #success=1 #failure=3
    Environment:
      POD_NAMESPACE:  nginx-ingress (v1:metadata.namespace)
      POD_NAME:       my-ingress03-nginx-ingress-cr5k7 (v1:metadata.name)
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from my-ingress03-nginx-ingress-token-xlggb (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             True 
  ContainersReady   True 
  PodScheduled      True 
Volumes:
  my-ingress03-nginx-ingress-token-xlggb:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  my-ingress03-nginx-ingress-token-xlggb
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/disk-pressure:NoSchedule
                 node.kubernetes.io/memory-pressure:NoSchedule
                 node.kubernetes.io/not-ready:NoExecute
                 node.kubernetes.io/pid-pressure:NoSchedule
                 node.kubernetes.io/unreachable:NoExecute
                 node.kubernetes.io/unschedulable:NoSchedule
Events:          <none>

  • Version of Kubernetes

$ kubectl version

Client Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.4", GitCommit:"8d8aa39598534325ad77120c120a22b3a990b5ea", GitTreeState:"clean", BuildDate:"2020-03-12T21:03:42Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.10", GitCommit:"62876fc6d93e891aa7fbe19771e6a6c03773b0f7", GitTreeState:"clean", BuildDate:"2020-10-15T01:43:56Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}
  • Kubernetes platform (e.g. Mini-kube or GCP)

Bare metal / Rancher 2.4.8

  • Using NGINX or NGINX Plus

nginx

Additional context
Add any other context about the problem here. Any log files you want to share.

$ kubectl describe svc my-ingress03-nginx-ingress -n nginx-ingress

Name:                     my-ingress03-nginx-ingress
Namespace:                nginx-ingress
Labels:                   app.kubernetes.io/instance=my-ingress03
                          app.kubernetes.io/managed-by=Helm
                          app.kubernetes.io/name=my-ingress03-nginx-ingress
                          helm.sh/chart=nginx-ingress-0.7.0
Annotations:              field.cattle.io/publicEndpoints:
                            [{"addresses":["x.x.x.x"],"port":80,"protocol":"TCP","serviceName":"nginx-ingress:my-ingress03-nginx-ingress","allNodes":false},{"add...
                          meta.helm.sh/release-name: my-ingress03
                          meta.helm.sh/release-namespace: nginx-ingress
Selector:                 app=my-ingress03-nginx-ingress
Type:                     LoadBalancer
IP:                       10.43.88.181
LoadBalancer Ingress:     x.x.x.x
Port:                     http  80/TCP
TargetPort:               80/TCP
NodePort:                 http  32309/TCP
Endpoints:                10.42.0.28:80,10.42.1.52:80
Port:                     https  443/TCP
TargetPort:               443/TCP
NodePort:                 https  32487/TCP
Endpoints:                10.42.0.28:443,10.42.1.52:443
Session Affinity:         None
External Traffic Policy:  Local
HealthCheck NodePort:     31847
Events:
  Type    Reason        Age                    From                Message
  ----    ------        ----                   ----                -------
  Normal  IPAllocated   7m33s                  metallb-controller  Assigned IP "x.x.x.x"
  Normal  nodeAssigned  7m22s (x3 over 7m24s)  metallb-speaker     announcing from node "k8s-node01"
  Normal  nodeAssigned  7m22s                  metallb-speaker     announcing from node "k8s-node02"

$ kubectl get ingressclasses

NAME    CONTROLLER                     PARAMETERS   AGE
nginx   nginx.org/ingress-controller   <none>       21h

$ kubectl describe ingressclasses

Name:         nginx
Namespace:    
Labels:       app.kubernetes.io/managed-by=Helm
Annotations:  ingressclass.kubernetes.io/is-default-class: true
              meta.helm.sh/release-name: my-ingress03
              meta.helm.sh/release-namespace: nginx-ingress
API Version:  networking.k8s.io/v1beta1
Kind:         IngressClass
Metadata:
  Creation Timestamp:  2020-11-06T00:06:42Z
  Generation:          1
  Managed Fields:
    API Version:  networking.k8s.io/v1beta1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .:
          f:ingressclass.kubernetes.io/is-default-class:
          f:meta.helm.sh/release-name:
          f:meta.helm.sh/release-namespace:
        f:labels:
          .:
          f:app.kubernetes.io/managed-by:
      f:spec:
        f:controller:
    Manager:         Go-http-client
    Operation:       Update
    Time:            2020-11-06T00:06:42Z
  Resource Version:  1768282
  Self Link:         /apis/networking.k8s.io/v1beta1/ingressclasses/nginx
  UID:               545dfeb6-3bf1-46ec-a6b6-8db9376f77ed
Spec:
  Controller:  nginx.org/ingress-controller
Events:        <none>
@cdunford
Copy link

I believe we are seeing the same issue on clusters running Kubernetes 1.18.8 and 1.18.10; we have to apply either ingressClassName or the legacy kubernetes.io/ingress.class annotation in order for the controller to wire up to an ingress resource even though we have setAsDefaultIngress set to true

@mofm
Copy link
Author

mofm commented Nov 29, 2020

NGINX Ingress Controller 1.9.1, helm chart 0.7.1 solved this issue and I have tested successfully. Thanks.

@mofm mofm closed this as completed Nov 29, 2020
@nashant
Copy link

nashant commented Aug 25, 2021

I'm getting this problem on EKS 1.18 with every version after helm 0.6.1 / controller 1.8.1.

With chart v0.6.1 ingresses get the address of the load balancer auto-assigned, with v0.7.1 onwards nothing gets an address without specifying an ingress class by ingressClassName or annotation.

Please advise

@brianehlert
Copy link
Collaborator

NGINX Ingress Controller followed the K8s implementation of IngressClass with release 1.9.0
https://docs.nginx.com/nginx-ingress-controller/releases/#nginx-ingress-controller-190

Our Helm chart 0.8.0 included a fix for ingressClass for K8s 1.18
https://docs.nginx.com/nginx-ingress-controller/releases/#nginx-ingress-controller-1100

@nashant
Copy link

nashant commented Aug 26, 2021

But shouldn't this mean that ingresses still get assigned the default class? Mine are not. And in the logs I'm getting:

W0826 14:16:52.032893       1 main.go:310] The '-use-ingress-class-only' flag will be deprecated and has no effect on versions of kubernetes >= 1.18.0. Processing ONLY resources that have the 'ingressClassName' field in Ingress equal to the class.
...
...
I0826 14:16:52.090390       1 listener.go:55] Starting Prometheus listener on: :9113/metrics                                                                                                                 
I0826 14:16:52.092336       1 leaderelection.go:243] attempting to acquire leader lease nginx-ingress/nginx-ingress-nginx-ingress-leader-election...                                                         
W0826 14:16:52.495538       1 controller.go:3048] Using the DEPRECATED annotation 'kubernetes.io/ingress.class'. The 'ingressClassName' field will be ignored.                                               
W0826 14:16:52.495603       1 controller.go:3048] Using the DEPRECATED annotation 'kubernetes.io/ingress.class'. The 'ingressClassName' field will be ignored.                                               
W0826 14:16:52.495625       1 controller.go:3048] Using the DEPRECATED annotation 'kubernetes.io/ingress.class'. The 'ingressClassName' field will be ignored.                                               
W0826 14:16:52.495640       1 controller.go:3048] Using the DEPRECATED annotation 'kubernetes.io/ingress.class'. The 'ingressClassName' field will be ignored.                                               
W0826 14:16:52.495653       1 controller.go:3048] Using the DEPRECATED annotation 'kubernetes.io/ingress.class'. The 'ingressClassName' field will be ignored.                                               
W0826 14:16:52.495668       1 controller.go:3048] Using the DEPRECATED annotation 'kubernetes.io/ingress.class'. The 'ingressClassName' field will be ignored.                                               
W0826 14:16:52.495940       1 controller.go:3048] Using the DEPRECATED annotation 'kubernetes.io/ingress.class'. The 'ingressClassName' field will be ignored.                                               

Why is it using the annotaion? I've got no ingresses with the annotation set

$ k get svc -Ao yaml | grep 'ingress.class'

Here's the helm values I've got:

controller:
  setAsDefaultIngress: true
  affinity:
    podAffinity:
      requiredDuringSchedulingIgnoredDuringExecution: []
    podAntiAffinity:
      preferredDuringSchedulingIgnoredDuringExecution:
      - podAffinityTerm:
          labelSelector:
            matchLabels:
              app: nginx-ingress-nginx-ingress
          topologyKey: failure-domain.beta.kubernetes.io/zone
        weight: 50
      requiredDuringSchedulingIgnoredDuringExecution: []
  appprotect:
    enable: false
  config:
    entries:
      log-format: '{"@timestamp":"$time_local","http_referer":"$http_referer","http_user_agent":"$http_user_agent","message":"$request","remote_addr":"$remote_addr","remote_user":"$remote_user","request_time":"$request_time","ssl_cipher":"$ssl_cipher","ssl_protocol":"$ssl_protocol","status":"$status","upstream_response_time":"$upstream_response_time"}'
      server-snippets: |
        proxy_intercept_errors on;
​
        error_page 403 /errors/403;
        error_page 404 /errors/404;
​
        location /errors/ {
          proxy_set_header X-Code $status;
          proxy_pass http://status.nginx-ingress.svc.cluster.local:8080/;
        }
      server-tokens: "False"
      ssl-ciphers: AESGCM:!SSLv2:!SSLv3:!TLSv1:!eNULL:!aNULL
      ssl-protocols: TLSv1.2 TLSv1.3
      stream-log-format: '{"@timestamp":"$time_local","bytes_received":"$bytes_received","bytes_sent":"$bytes_sent","protocol":"$protocol","remote_addr":"$remote_addr","session_time":"$session_time","ssl_preread_server_name":"$ssl_preread_server_name","status":"$status","upstream_addr":"$upstream_addr","upstream_bytes_received":"$upstream_bytes_received","upstream_bytes_sent":"$upstream_bytes_sent","upstream_connect_time":"$upstream_connect_time"}'
    name: nginx-ingress-config
  customPorts:
  - containerPort: 22
    name: ssh
  - containerPort: 9200
    name: elastic
  - containerPort: 9300
    name: es-transport
  - containerPort: 21050
    name: impala
  enableCustomResources: false
  ingressClass: private
  replicaCount: 3
  service:
    annotations:
      service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp
      service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout: "60"
      service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled: "true"
      service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0
      service.beta.kubernetes.io/aws-load-balancer-type: nlb
    create: "true"
    customPorts:
    - name: ssh
      port: 22
    - name: elastic
      port: 9200
    - name: es-transport
      port: 9300
    - name: impala
      port: 21050
    httpPort:
      enable: false
    httpsPort:
      enable: true
    type: LoadBalancer
  tolerations: []
  useIngressClassOnly: "false"

@matti
Copy link

matti commented Sep 5, 2021

same here:

-------------------------------------------------------------------------------
NGINX Ingress controller
  Release:       v1.0.0
  Build:         041eb167c7bfccb1d1653f194924b0c5fd885e10
  Repository:    https://github.com/kubernetes/ingress-nginx
  nginx version: nginx/1.20.1

-------------------------------------------------------------------------------

W0905 15:11:04.846482       8 client_config.go:615] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.
I0905 15:11:04.846643       8 main.go:221] "Creating API client" host="https://10.43.0.1:443"
I0905 15:11:04.851799       8 main.go:265] "Running in Kubernetes cluster" major="1" minor="21" git="v1.21.4+k3s1" state="clean" commit="3e250fdbab72d88f7e6aae57446023a0567ffc97" platform="linux/amd64"
I0905 15:11:05.016483       8 main.go:104] "SSL fake certificate created" file="/etc/ingress-controller/ssl/default-fake-certificate.pem"
I0905 15:11:05.042169       8 nginx.go:253] "Starting NGINX Ingress controller"
I0905 15:11:05.047841       8 event.go:282] Event(v1.ObjectReference{Kind:"ConfigMap", Namespace:"default", Name:"ingress-nginx-controller", UID:"733fe07e-9769-43cd-9fff-b2ebf25d022a", APIVersion:"v1", ResourceVersion:"446", FieldPath:""}): type: 'Normal' reason: 'CREATE' ConfigMap default/ingress-nginx-controller
I0905 15:11:06.147052       8 store.go:361] "Ignoring ingress because of error while validating ingress class" ingress="default/registry" error="ingress does not contain a valid IngressClass"
I0905 15:11:06.243947       8 nginx.go:295] "Starting NGINX process"

^-- see error="ingress does not contain a valid IngressClass"

but I do have this:

apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
  annotations:
    ingressclass.kubernetes.io/is-default-class: "true"
    meta.helm.sh/release-name: ingress-nginx
    meta.helm.sh/release-namespace: default
  creationTimestamp: "2021-09-05T15:10:33Z"
  generation: 1
  labels:
    app.kubernetes.io/component: controller
    app.kubernetes.io/instance: ingress-nginx
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/version: 1.0.0
    helm.sh/chart: ingress-nginx-4.0.1
  name: nginx
  resourceVersion: "459"
  uid: 394c571c-c382-494d-9ba8-2fcd59be8440
spec:
  controller: k8s.io/ingress-nginx

^-- see ingressclass.kubernetes.io/is-default-class: "true"

@jasonwilliams14
Copy link
Contributor

jasonwilliams14 commented Sep 5, 2021

@nashant
Did you see your IngressClass to be the default across the cluster?
With the K8 1.18 changes and introduction of IngressClass, you have to specifically define a ingressclass in your setup (if you want to run more than one ingressclass) or you need to configure a specific ingressclass to be the default for the cluster.

https://kubernetes.io/docs/concepts/services-networking/ingress/#default-ingress-class

@matti
That is the community edition Ingress product, different from this particular product. Either way, the same rules still apply ( to any ingress product based upon kubernetes changes).

HTH

@nashant
Copy link

nashant commented Sep 5, 2021

Certainly did.

apiVersion: networking.k8s.io/v1beta1
kind: IngressClass
metadata:
  annotations:
    ingressclass.kubernetes.io/is-default-class: "true"
    meta.helm.sh/release-name: nginx-ingress
    meta.helm.sh/release-namespace: nginx-ingress
  creationTimestamp: "2021-08-26T15:05:52Z"
  generation: 1
  labels:
    app.kubernetes.io/managed-by: Helm
  name: private
  resourceVersion: "15696578"
  selfLink: /apis/networking.k8s.io/v1beta1/ingressclasses/private
  uid: 74065f33-2a94-466d-adf1-9546f61c7055
spec:
  controller: nginx.org/ingress-controller

@laundry-96
Copy link

@nashant @matti
This doesn't fix the 'is-default-class' issue, but a way around this is updating the values used to deploy with helm.
NOTE: I'm not sure how to make this fix outside of helm.

Grab the values for the chart
helm show values ingress-nginx/ingress-nginx > /tmp/nginx-val.yml

line 67: change false to true like so:
watchIngressWithoutClass: true

Now update the current release on the kubernetes cluster with the values we just edited (if installing for first time, replace update with install)
helm upgrade ingress-nginx ingress-nginx/ingress-nginx -n ingress-nginx --values /tmp/nginx-val.yml

@sbugalski
Copy link

sbugalski commented Sep 9, 2021

@nashant @matti
This doesn't fix the 'is-default-class' issue, but a way around this is updating the values used to deploy with helm.
NOTE: I'm not sure how to make this fix outside of helm.

Grab the values for the chart
helm show values ingress-nginx/ingress-nginx > /tmp/nginx-val.yml

line 67: change false to true like so:
watchIngressWithoutClass: true

Now update the current release on the kubernetes cluster with the values we just edited (if installing for first time, replace update with install)
helm upgrade ingress-nginx ingress-nginx/ingress-nginx -n ingress-nginx --values /tmp/nginx-val.yml

Yeah, setting up watchIngressWithoutClass worked for me. Thanks for advice.

Chart: ingress-nginx-4.0.1
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.9"

It's important to remove ingress.class annotation otherwise workaround will not work

  annotations:
    kubernetes.io/ingress.class: <...>

@nashant
Copy link

nashant commented Sep 9, 2021

@laundry-96 you're on the wrong ingress controller.

$ ~/src $ helm pull --untar nginx-stable/nginx-ingress 
$ ~/src $ cd nginx-ingress/
$ ~/src/nginx-ingress $ grep -r watchIngress
$ ~/src/nginx-ingress $ 

@laundry-96
Copy link

@nashant Oh wow. I did not know there were two different nginx charts... Please ignore my comment then :)

@abhishekdanej
Copy link

abhishekdanej commented Nov 1, 2021

Hi, I'm trying to get ingress to work on k1.21 on docker-desktop for windows, but don't see the o/p from curl. Initially I was facing the 'default class' issue, which I could resolve by looking at the logs of ingress-controller and then setting the ingressClassname in ingress object. Still it is not working. Service is working though. Can someone pls advise? Here is my setup

Ingress:

root@INADanej01:/mnt/c/Users/ADanej/ckad# k get ingress my-httpd-ingress -oyaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  creationTimestamp: "2021-11-01T05:00:32Z"
  generation: 1
  name: my-httpd-ingress
  namespace: default
  resourceVersion: "612626"
  uid: 5b2f9d43-6e3e-4370-b297-ef9290c2650b
spec:
  ingressClassName: nginx
  rules:
  - host: mypc.com
    http:
      paths:
      - backend:
          service:
            name: my-httpd
            port:
              number: 80
        path: /
        pathType: Prefix
status:
  loadBalancer:
    ingress:
    - hostname: localhost

IngressClass

root@INADanej01:/mnt/c/Users/ADanej/ckad# k get ingressclasses.networking.k8s.io nginx -oyaml
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
  annotations:
    ingressclass.kubernetes.io/is-default-class: "true"
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"networking.k8s.io/v1","kind":"IngressClass","metadata":{"annotations":{},"labels":{"app.kubernetes.io/component":"controller","app.kubernetes.io/instance":"ingress-nginx","app.kubernetes.io/managed-by":"Helm","app.kubernetes.io/name":"ingress-nginx","app.kubernetes.io/version":"1.0.4","helm.sh/chart":"ingress-nginx-4.0.6"},"name":"nginx"},"spec":{"controller":"k8s.io/ingress-nginx"}}
  creationTimestamp: "2021-10-30T14:41:57Z"
  generation: 1
  labels:
    app.kubernetes.io/component: controller
    app.kubernetes.io/instance: ingress-nginx
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/version: 1.0.4
    helm.sh/chart: ingress-nginx-4.0.6
  name: nginx
  resourceVersion: "604672"
  uid: 6b1b7f71-caed-4b3e-ab3e-d027dcc29499
spec:
  controller: k8s.io/ingress-nginx

Service

root@INADanej01:/mnt/c/Users/ADanej/ckad# k get svc my-httpd -oyaml
apiVersion: v1
kind: Service
metadata:
  creationTimestamp: "2021-10-30T14:49:35Z"
  labels:
    app: my-httpd
  name: my-httpd
  namespace: default
  resourceVersion: "567447"
  uid: d215e832-9774-4111-9da7-63ed6175b2b8
spec:
  clusterIP: 10.102.35.225
  clusterIPs:
  - 10.102.35.225
  externalTrafficPolicy: Cluster
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - nodePort: 30114
    port: 80
    protocol: TCP
    targetPort: 80
  selector:
    app: my-httpd
  sessionAffinity: None
  type: NodePort
status:
  loadBalancer:
    ingress:
    - hostname: localhost

Curl output for localhost:30114 (Type nodeport)

root@INADanej01:/mnt/c/Users/ADanej/ckad# curl localhost:30114
<html><body><h1>It works!</h1></body></html>

Etc/hosts (using wsl2)

root@INADanej01:/mnt/c/Users/ADanej/ckad# cat /etc/hosts
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateHosts = false
127.0.0.1       localhost
127.0.1.1       INADanej01.microfocus.com       INADanej01

192.168.1.25    host.docker.internal
192.168.1.25    gateway.docker.internal
127.0.0.1       kubernetes.docker.internal

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.0.1       mypc.com

@brianehlert
Copy link
Collaborator

@abhishekdanej If this continues to be an issue with kubernetes-ingress please open an issue, rather than commenting on a closed issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants