Kubernetes MetalLB External IP not reachable from browser

1.8k views Asked by At

I have a nginx deployment with service type LoadBalancer. I got a external IP which is accessible from master and worker node. I am not able to access it from browser.

What am I missing?

2

There are 2 answers

0
Cort On

I have had the same. But I am running minikube. So, changing minikube driver helped me.

0
Duleepa Wickramasinghe On

You can follow the below steps to access it from the browser.

  1. Deploy Nginx in your Kubernetes environment by executing the below YAML file.

    kubectl create -f {YAML file location}

apiVersion: apps/v1
kind: Deployment
metadata:
 name: nginx-deployment
 labels:
   app: nginx
spec:
 replicas: 3
 selector:
   matchLabels:
     app: nginx
 template:
   metadata:
     labels:
       app: nginx
   spec:
     containers:
     - name: nginx
       image: nginx:1.14.2
       ports:
       - containerPort: 80

enter image description here

  1. Execute below nginx-service YAML to access it from the browser.

    kubectl create -f {YAML file location}

#Service
#nginx-svc-np.yaml
apiVersion: v1
kind: Service
metadata:
  name: nginx-service
  labels:
    app: nginx
spec:
  selector:
    app: nginx
  type: LoadBalancer
  ports:
  - port: 80
    targetPort: 80
  externalIPs:
    - 192.168.1.155

enter image description here

  1. Now you can access Nginx from your browser.

    http://192.168.1.155/ (Please use your external IP)

enter image description here