This message was deleted.
# rancher-desktop
a
This message was deleted.
a
The host should be set if you want to use something else than
localhost
. Host is not required.
b
@aloof-controller-49647 but I could not able to access somehow even if I tried localhost or without host
I can able to access via port-forward but not with
192.168.178.38
.. What I am doing wrong?
a
Did you disable traefik?
b
yeah worked after i refactor my ingress
a
So it is fixed? If yes, what did you do?
b
I changed my ingress resource and add some annotations
a
Could you specify the changes explicitly?
It might be helpful for others.
b
this is how it looks like now
Copy code
apiVersion: <http://networking.k8s.io/v1|networking.k8s.io/v1>
kind: Ingress
metadata:
  name: {{ include "frontend-service.fullname" . }}
  namespace: comnext
  annotations:
    <http://kubernetes.io/ingress.class|kubernetes.io/ingress.class>: "nginx"
    <http://nginx.ingress.kubernetes.io/service-upstream|nginx.ingress.kubernetes.io/service-upstream>: "true"
    <http://nginx.ingress.kubernetes.io/configuration-snippet|nginx.ingress.kubernetes.io/configuration-snippet>: |
      proxy_set_header l5d-dst-override frontend-service.comnext.svc.cluster.local;
      proxy_hide_header l5d-remote-ip;
      proxy_hide_header l5d-server-id;
spec:
  rules:
    - host: localhost
      http:
        paths:
          - backend:
              service:
                name: frontend-service
                port:
                  number: 80
            path: /
            pathType: ImplementationSpecific
a
💪
o
Note that if you run
kubectl explain --api-version=<http://networking.k8s.io/v1|networking.k8s.io/v1> Ingress.spec.ingressClassName
you will see:
Copy code
DESCRIPTION:
     IngressClassName is the name of the IngressClass cluster resource. The
     associated IngressClass defines which controller will implement the
     resource. This replaces the deprecated `<http://kubernetes.io/ingress.class|kubernetes.io/ingress.class>`
     annotation.
So at some point, you will need to remove the
<http://kubernetes.io/ingress.class|kubernetes.io/ingress.class>
annotation and change your
spec
section to:
Copy code
spec:
  ingressClassName: nginx
  rules:
    - host: localhost
      http:
        paths:
          - backend:
              service:
                name: frontend-service
                port:
                  number: 80
            path: /
            pathType: ImplementationSpecific
b
@orange-tent-50778 you re right.. By the way, when I remove localhost, i am getting an error that host required.. Should I speficy the host in rancher-desktop to access my app
o
I don't know if this is the best approach but this is that I have setup for our project (the project is called The Combine which will help explain some of the names):
Copy code
apiVersion: <http://networking.k8s.io/v1|networking.k8s.io/v1>
kind: Ingress
metadata:
  annotations:
    <http://cert-manager.io/duration|cert-manager.io/duration>: 2160h
    <http://cert-manager.io/issuer|cert-manager.io/issuer>: self-signed
    <http://cert-manager.io/renew-before|cert-manager.io/renew-before>: 720h
    <http://nginx.ingress.kubernetes.io/proxy-body-size|nginx.ingress.kubernetes.io/proxy-body-size>: 250m
  creationTimestamp: "2022-09-05T14:23:41Z"
  generation: 1
  name: thecombine
  namespace: thecombine
  resourceVersion: "4294"
  uid: 7dbe724d-a005-4bce-9d89-a104507b93fc
spec:
  ingressClassName: nginx
  rules:
  - host: thecombine.local
    http:
      paths:
      - backend:
          service:
            name: frontend
            port:
              number: 80
        path: /
        pathType: Prefix
  tls:
  - hosts:
    - thecombine.local
    secretName: thecombine-local-tls
status:
  {}
I am using helm so I removed the parts added by it. I am also using cert-manager.io to create a self-signed certificate. Secondly, I have updated my
/etc/hosts
to contain:
Copy code
127.0.0.1	localhost thecombine.local
Last of all, I setup the port forwarding in Rancher Desktop to forward 37700 to the
ingress-nginx
https port. Now I can access my front end by navigating to
<https://thecombine.local:37700>
. Since it has a self-signed certificate, I need to assure the browser that I know what I am doing and accept the risk.
b
How do you access backend services if you have any frotnend service ?
Somehow I could not able to do this
@orange-tent-50778 how frontend service access another backend services in rancher-desktop?