kubernates on prem 502 bad gateway

Hi I have installed and configured kubernates I have tried with both minikube and kubeadm What I have installed: flannel, nginx-ingress-controller, metalLB then setted ngix-ingress-controller service to be loadBalancer

I always get 502 bad gateway when trying to expose a simple wordpress app (using clusterIp or even with nodePort)

OS: ubuntu 20.04 LTS installed docker-ce, kubeadm and kubelt (official kubernates site tutorial)

Installation procedure i have followed: Kube init:

kubeadm init --pod-network-cidr=10.244.0.0/16

kubectl taint nodes --all node-role.kubernetes.io/master-

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

flannel:

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

nginx

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/baremetal/deploy.yaml

metallb: followed onsite tutorial

I have tryed to change ingress-nginx-controller service to be LoadBalancer and add the externalIP but nothing changes

here are my yamls: service

apiVersion: v1
kind: Service
metadata:
  labels:
    appcluster: kubernetes
    app: wordpress
  name: wordpress-service
spec:
  ports:
  - port: 80
    targetPort: 80
    name: http-port
  selector:
    app: wordpress
  type: ClusterIP

ingress

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: wordpress-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
    - host: ethernial.com
      http:
        paths:
          - path: /?(.*)
            backend:
              serviceName: wordpress-service
              servicePort: 80

Solution 1:

Thanks to @Jakub I have missed to configure metalLB (create a config map) then I have setted ingress-nginx-controller to be loadBalancer works perfectly