Programing

kubernetes 서비스 외부 IP 보류 중

crosscheck 2020. 10. 9. 08:50
반응형

kubernetes 서비스 외부 IP 보류 중


kubernetes에 nginx를 배포하려고합니다. kubernetes 버전은 v1.5.2이고, 3 개의 복제본으로 nginx를 배포했습니다. YAML 파일은 아래와 같습니다.

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: deployment-example
spec:
  replicas: 3
  revisionHistoryLimit: 2
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.10
        ports:
        - containerPort: 80

이제 노드의 포트 30062에서 포트 80을 노출하고 싶습니다. 아래 서비스를 만들었습니다.

kind: Service
apiVersion: v1
metadata:
  name: nginx-ils-service
spec:
  ports:
    - name: http
      port: 80
      nodePort: 30062
  selector:
    app: nginx
  type: LoadBalancer

이 서비스는 정상적으로 작동하고 있지만 kubernetes 대시 보드뿐만 아니라 터미널에서도 보류중인 것으로 표시됩니다. 터미널 출력대시 보드 상태

이 문제를 해결하도록 도와주세요. 감사 ...


당신이 (사용하여 사용자는 Kubernetes 클러스터를 사용하는 것 같습니다 minikube, kubeadm등). 이 경우에는 통합 된 LoadBalancer가 없습니다 (AWS 또는 Google Cloud와 달리). 이 기본 설정에서는 NodePort또는 인 그레스 컨트롤러 만 사용할 수 있습니다 .

With the Ingress Controller you can setup a domain name which maps to your pod; you don't need to give your Service the LoadBalancer type if you use an Ingress Controller.


If you are not using GCE or EKS (you used kubeadm) you can add an externalIPs spec to your service YAML. You can use the IP associated with your node's primary interface such as eth0. You can then access the service externally, using the external IP of the node.

...
spec:
  type: LoadBalancer
  externalIPs:
  - 192.168.0.10

To access a service on minikube, you need to run the following command:

minikube service [-n NAMESPACE] [--url] NAME

More information here : Minikube GitHub


If you are using Minikube, there is a magic command!

$ minikube tunnel

Hopefully someone can save a few minutes with this.

Reference link https://github.com/kubernetes/minikube/blob/master/docs/networking.md#loadbalancer-emulation-minikube-tunnel


I created a single node k8s cluster using kubeadm. When i tried PortForward and kubectl proxy, it showed external IP as pending.

$ kubectl get svc -n argocd argocd-server
NAME            TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
argocd-server   LoadBalancer   10.107.37.153   <pending>     80:30047/TCP,443:31307/TCP   110s

In my case I've patched the service like this:

kubectl patch svc <svc-name> -n <namespace> -p '{"spec": {"type": "LoadBalancer", "externalIPs":["172.31.71.218"]}}'

After this, it started serving over the public IP

$ kubectl get svc argo-ui -n argo
NAME      TYPE           CLUSTER-IP     EXTERNAL-IP     PORT(S)        AGE
argo-ui   LoadBalancer   10.103.219.8   172.31.71.218   80:30981/TCP   7m50s

If running on minikube, don't forget to mention namespace if you are not using default.

minikube service << service_name >> --url --namespace=<< namespace_name >>


same issue:

os>kubectl get svc right-sabertooth-wordpress

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S)
right-sabertooth-wordpress LoadBalancer 10.97.130.7 "pending" 80:30454/TCP,443:30427/TCP

os>minikube service list

|-------------|----------------------------|--------------------------------|

| NAMESPACE | NAME | URL |

|-------------|----------------------------|--------------------------------|

| default | kubernetes | No node port |

| default | right-sabertooth-mariadb | No node port |

| default | right-sabertooth-wordpress | http://192.168.99.100:30454 |

| | | http://192.168.99.100:30427 |

| kube-system | kube-dns | No node port |

| kube-system | tiller-deploy | No node port |

|-------------|----------------------------|--------------------------------|

It is, however,accesible via that http://192.168.99.100:30454.


Use NodePort:

kubectl run user-login --replicas=2 --labels="run=user-login" --image=kingslayerr/teamproject:version2 --port=5000

kubectl expose deployment user-login --type=NodePort --name=user-login-service

kubectl describe services user-login-service (Note down the port)

kubect cluster-info (IP-> Get The IP where master is running)

Your service is accessible at (IP):(port)


delete existing service and create a same new service solved my problems. My problems is that the loading balancing Ip I defines is used so that external endpoint is pending. When I changed a new load balancing IP it still coundn't work. Finally, delete existing service and create a new one solved my problem.


Check kube-controller logs. I was able to solve this issue by setting the clusterID tags to the ec2 instance I deployed the cluster on.


@ Javier의 답변을 따릅니다. 로드 밸런서를 위해 "외부 IP 패치"를 사용하기로 결정했습니다.

 $ kubectl patch service my-loadbalancer-service-name \
-n lb-service-namespace \
-p '{"spec": {"type": "LoadBalancer", "externalIPs":["192.168.39.25"]}}'

그러면 해당 '보류 중'이 클러스터에 사용할 수있는 패치 된 새 IP 주소로 바뀝니다.

이에 대한 자세한 내용은. Kubernetes 용 Minikube를 사용한 LoadBalancer 지원에 대한 karthik 게시물을 참조하십시오.

그것을 수행하는 가장 깨끗한 방법이 아닙니다. 임시 해결책이 필요했습니다. 이것이 누군가를 돕기를 바랍니다.


Minikube를 사용하는 경우 minikube service kubia-http를 실행하여 서비스에 액세스 할 수있는 IP 및 포트를 얻을 수 있습니다.

참고 URL : https://stackoverflow.com/questions/44110876/kubernetes-service-external-ip-pending

반응형