This message was deleted.
# rancher-desktop
a
This message was deleted.
m
I assume that you have installed the nginx-ingress controller as by default Rancher-Desktop uses "traefik" as the ingress-controller. If you define the host as "frontend-service.localhost" you should be able to access your service from a browser. All FQDNs ending with "*.localhost" do not need DNS entries as these should always be interpreted as IP 127.0.0.1 by the browser, if you use other names you will have to enter these into a DNS Server or in a local "hosts" file. The frontend service on the other hand can access backend services in the same namespace by just using the servicename and does not need to be quailified unless in a different namespace. The DNS lookups are then done inside kubernetes via coredns.
b
@miniature-advantage-69986 I could not get %100.. 😞 What you are saying is, use
frontend-service.localhost
as a hostname and rest of the services name should be end with
.localhost
, am I right ? Then can browser/frontend access rest of microservices via their DNS names, am I right ?
m
No, i'm afraid i wasn't very clear. If you want to access services fron outside of kubernetes (for example from your browser) you will be doing this through an ingress-contoller and wil need an ingress manifest for each service you wish to access. if you have services in kubernetes that need to communicate with other services in the same cluster, then these can just do so by using te service name. Example: frontend-service can just do something like
curl <http://backend-service>
but if you want to access backend-service from your browser or curl on your windows/mac/linux you would have to setup an ingress with something like host: backend-service.kubernetes.localhost and then you can open http://backend-service.localhost
Sorry, i made a typo. If the ingress definition is host: backend-service.kubernetes.localhost you would open it with the URL http://backend-service.kubernetes.localhost
b
@miniature-advantage-69986 its totally clear now.. Is there any other way to achieve this via nginx for instance ?
b
Check out this article for a very simple example: https://itnext.io/simplest-minimal-k8s-app-tutorial-with-rancher-desktop-in-5-min-5481edb9a4a5
Copy code
apiVersion: <http://networking.k8s.io/v1|networking.k8s.io/v1>
kind: Ingress
metadata:
  name: jade-shooter
spec:
  rules:
  - host: jade-shooter.rancher.localhost
    http:
      paths:
      - pathType: Prefix
        path: /
        backend:
          service:
            name: jade-shooter-service
            port:
              number: 8080
  tls:
  - hosts:
    - jade-shooter.rancher.localhost