0

I'm new to Kubernetes and was trying to expose my service (Nginx) via ingress resource. ingress controller is already installed via helm nginx-stable/nginx-ingress. when trying to access the said IP and port from the ingress resource. it is unreachable and by doing some research I saw that I need to install metalLB.

My question is do I really need to install MetalLB or are there any alternative built-in resources that I can configure or use to route the traffic?

Frant
  • 5,382
  • 1
  • 16
  • 22
  • Please provide more details about your environment. Is it locally installed kubernetes cluster on your laptop/desktop or maybe on a virtual machine in some cloud environment ? How is your kubernetes set up ? Do you use **kubeadm** or maybe **minikube** ? What IP are you trying to access and how ? Do you simply open it in your web browser or maybe via `curl` ? If so, do you provide `hostname` in http header e.g. `curl --header 'Host: hello-world.info' http://10.0.2.15` ? – mario Dec 15 '20 at 14:38

2 Answers2

0

in short, you don't necessarily need to install metalLB to make a simple kubernetes configuration work. perhaps you could share the services information or error log which is unreachable

Yuyanto
  • 121
  • 9
0

Sorry for the delay due to holiday season..

I'm using Virtualbox with 3 machine running in

  • Ubuntu 20.04.1 LTS

K8s Version

  • Client Version: v1.20.1
  • Server Version: v1.20.1

Enabling Ingress helm install my-release nginx-stable/nginx-ingress

Deployment kubectl describe deployment --namespace helm-exam

Name:                   node-deployment-1
Namespace:              helm-exam
CreationTimestamp:      Fri, 08 Jan 2021 12:01:22 +0800
Labels:                 app=node-deployment-1
                        app.kubernetes.io/managed-by=Helm
Annotations:            deployment.kubernetes.io/revision: 1
                        meta.helm.sh/release-name: helm-deployment
                        meta.helm.sh/release-namespace: default
Selector:               app=node-deployment-1
Replicas:               3 desired | 3 updated | 3 total | 3 available | 0 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        0
RollingUpdateStrategy:  25% max unavailable, 25% max surge
Pod Template:
  Labels:  app=node-deployment-1
  Containers:
   nginx:
    Image:      nginx
    Port:       <none>
    Host Port:  <none>
    Environment:
      ENVIRONMENT:  DEV
    Mounts:         <none>
  Volumes:          <none>
Conditions:
  Type           Status  Reason
  ----           ------  ------
  Available      True    MinimumReplicasAvailable
  Progressing    True    NewReplicaSetAvailable
OldReplicaSets:  <none>
NewReplicaSet:   node-deployment-1-78dd8f445b (3/3 replicas created)
Events:          <none>

Service

kubectl describe svc --namespace helm-exam

Name:              node-service-1
Namespace:         helm-exam
Labels:            app=node-service-1
                   app.kubernetes.io/managed-by=Helm
Annotations:       meta.helm.sh/release-name: helm-deployment
                   meta.helm.sh/release-namespace: default
Selector:          app=node-deployment-1
Type:              ClusterIP
IP Families:       <none>
IP:                10.109.148.140
IPs:               10.109.148.140
Port:              <unset>  80/TCP
TargetPort:        80/TCP
Endpoints:         10.244.1.26:80,10.244.1.27:80,10.244.1.28:80
Session Affinity:  None
Events:            <none>

Ingress

kubectl describe ingress --namespace helm-exam

Name:             node-ingress
Namespace:        helm-exam
Address:          
Default backend:  default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
Rules:
  Host            Path  Backends
  ----            ----  --------
  nginx.helm.com  
                  /   node-service-1:80 (10.244.1.26:80,10.244.1.27:80,10.244.1.28:80)
Annotations:      meta.helm.sh/release-name: helm-deployment
                  meta.helm.sh/release-namespace: default
Events:           <none>

kubectl get ingress --namespace helm-exam

NAME           CLASS    HOSTS            ADDRESS   PORTS   AGE
node-ingress   <none>   nginx.helm.com             80      8m57s

Ingress doesn't show or provide any IP ADDRESS

  • Please don't put additional detail related to the question as an answer as it suggests this is a solution for your issue. Instead, [edit your question](https://stackoverflow.com/posts/65299826/edit) and add those details there. Did you manage to find the solution ? You didn't mention anywhere how your cluster was set up. Is it simple kubeadm-based installation ? If it's on premise k8s cluster, ingress won't automatically provide any IP adress, like in cloud environments, so the result you get is totally expected. – mario Jan 20 '21 at 18:23
  • If it's one-node Minikube installation it's fairly simple and you don't need any additional load balancers installed to be able to use ingress in your local test environment (take a look at [this](https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/) article), but if you have multi-node k8s cluster, you may need to use [one of the approaches](https://kubernetes.github.io/ingress-nginx/deploy/baremetal/) described in the official nginx-ingress controller docs. – mario Jan 20 '21 at 18:44