Home > Software design >  Ingress no address
Ingress no address

Time:04-12

I have little k8s cluster in my machine and I try to make something for learn but I stack right now.

I have 2 app, one of mysql and another one wordpress and they are working good. When I give a LoadBalancer type for wordpress, it's taking a ip and I can see in my browser.

So I want to create a Ingress and call by hostname but Ingress not take a Loadbalancer IP.. Am I doing wrong anythin?

This is my Ingress configuration

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: wp-ingress
  kubernetes.io/ingress.class: nginx
  labels:
    name: wp-ingress
spec:
  rules:
  - host: wordpress.pandora.local
    http:
      paths:
      - pathType: Prefix
        path: "/"
        backend:
          service:
            name: wp-svc
            port: 
              number: 80
  - host: phpmyadmin.pandora.local
    http:
      paths:
      - pathType: Prefix
        path: "/"
        backend:
          service:
            name: phpmyadmin-svc
            port: 
              number: 80

and problem

# kg ingress
NAME         CLASS    HOSTS                                              ADDRESS   PORTS   AGE
wp-ingress   <none>   wordpress.pandora.local,phpmyadmin.pandora.local             80      38m

I'm using a Metallb for loadbalancer and I know it's work becasue of wordpress, but if you want to see

kg svc -A
NAMESPACE          NAME                                 TYPE           CLUSTER-IP       EXTERNAL-IP      PORT(S)                      AGE
calico-apiserver   calico-api                           ClusterIP      10.108.149.243   <none>           443/TCP                      45h
calico-system      calico-kube-controllers-metrics      ClusterIP      10.100.211.40    <none>           9094/TCP                     45h
calico-system      calico-typha                         ClusterIP      10.107.217.253   <none>           5473/TCP                     45h
default            kubernetes                           ClusterIP      10.96.0.1        <none>           443/TCP                      45h
default            mysql-svc                            ClusterIP      10.103.110.242   <none>           3306/TCP                     3h1m
default            phpmyadmin-svc                       ClusterIP      10.105.195.144   <none>           80/TCP                       156m
default            wp-svc                               ClusterIP      10.100.96.37     <none>           80/TCP                       126m
ingress-nginx      ingress-nginx-controller             LoadBalancer   10.99.196.206    192.168.188.20   80:30986/TCP,443:32709/TCP   49m
ingress-nginx      ingress-nginx-controller-admission   ClusterIP      10.99.212.249    <none>           443/TCP                      49m
kube-system        kube-dns                             ClusterIP      10.96.0.10       <none>           53/UDP,53/TCP,9153/TCP       45h

How can I troubleshoot the situation

CodePudding user response:

I solved. Thank for help :) The problem was about to ingress class.

kind: Ingress
metadata:
  name: wp-ingress
spec:
  rules:
  - host: wordpress.pandora.local
    http:
      paths:
      - pathType: Prefix
        path: "/"
        backend:
          service:
            name: wp-svc
            port:
              number: 80
  - host: phpmyadmin.pandora.local
    http:
      paths:
      - pathType: Prefix
        path: "/"
        backend:
          service:
            name: phpmyadmin-svc
            port:
              number: 80
  ingressClassName: nginx

I added the last line ingressClassName: nginx defination and it's work!

kg ingress
NAME         CLASS   HOSTS                                              ADDRESS         PORTS   AGE
wp-ingress   nginx   wordpress.pandora.local,phpmyadmin.pandora.local   192.168.88.20   80      5h19m
  • Related