kubernetes service external ip pending 解决方法
Centos7.7 安装docker与k8s后,使用dasbaord面板创建nginx服务后,
查看svc信息,外面接口一直显示 kubernetes service external ip pending
[root@localhost ~]# kubectl get pod -o wide
NAME READY STATUS RESTARTS AGE IP NODE
nginx-4153138332-hnhnm 1/1 Running 0 4m 172.17.0.4 127.0.0.1
nginx-4153138332-mhf83 1/1 Running 0 4m 172.17.0.3 127.0.0.1
[root@localhost ~]# kubectl get svc
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes 10.254.0.1 <none> 443/TCP 4h
nginx 10.254.29.219 <pending> 8888:32210/TCP 4m
使用以下方法解决问题。
[root@localhost ~]# kubectl get svc -n default nginx
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
nginx 10.254.29.219 <pending> 8888:32210/TCP 6m
[root@localhost ~]# kubectl patch svc nginx -n default -p '{"spec": {"type": "LoadBalancer", "externalIPs":["192.168.1.18"]}}'
"nginx" patched
[root@localhost ~]# kubectl get svc -n default nginx
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
nginx 10.254.29.219 ,192.168.1.18 8888:32210/TCP 8m
测试外网IP,通过 8888端口访问正常。
如果不行,关闭firewalld服务。
目录 返回
首页