请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

ingress-nginx无法启动

老师,你好
无法启动ingress-nginx,主节点状态

[root@server01 ingress-nginx]# kubectl get all -n ingress-nginx
NAME                                            READY   STATUS             RESTARTS   AGE
pod/default-http-backend-5c9bb94849-cbtb2       1/1     Running            0          10m
pod/nginx-ingress-controller-5d5dc7d9dd-lgt6d   0/1     CrashLoopBackOff   6          10m

NAME                           TYPE        CLUSTER-IP    EXTERNAL-IP   PORT(S)   AGE
service/default-http-backend   ClusterIP   10.99.17.59   <none>        80/TCP    10m

NAME                                       READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/default-http-backend       1/1     1            1           10m
deployment.apps/nginx-ingress-controller   0/1     1            0           10m

去从节点上面查看系统日志:

Error syncing pod cffc32c6-a0a8-11ea-bcc6-080027a4aa8b (“nginx-ingress-controller-5d5dc7d9dd-lgt6d_ingress-nginx(cffc32c6-a0a8-11ea-bcc6-080027a4aa8b)”), skipping: failed to “StartContainer” for “nginx-ingress-controller” with CrashLoopBackOff: “Back-off 5m0s restarting failed container=nginx-ingress-controller pod=nginx-ingress-controller-5d5dc7d9dd-lgt6d_ingress-nginx(cffc32c6-a0a8-11ea-bcc6-080027a4aa8b)”

查看pods日志:
kubectl logs nginx-ingress-controller-5d5dc7d9dd-lgt6d -n ingress-nginx
I0528 06:13:26.011841 6 main.go:191] Creating API client for https://10.96.0.1:443
I0528 06:13:26.020737 6 main.go:235] Running in Kubernetes cluster version v1.14 (v1.14.0) - git (clean) commit 641856db18352033a0d96dbc99153fa3b27298e5 - platform linux/amd64
F0528 06:13:26.020841 6 main.go:98] No service with name /default-http-backend found: an empty namespace may not be set when a resource name is provided

再之后不知道从哪个方向查了,从节点的系统日志不是很明确,请老师给指条明路。

正在回答

2回答

你好,先用kubectl describe一下pod,最下面有一些信息。另外kubectl logs时,加一个-f,等待看一会,注意error级别的日志

0 回复 有任何疑惑可以回复我~
  • 提问者 Allen_Liu_1106 #1
    感谢老师,解决了,我居然把PID看成端口号了。。。
    回复 有任何疑惑可以回复我~ 2020-05-31 17:51:38
提问者 Allen_Liu_1106 2020-05-29 09:56:56

老师早上好,

我网上查了下,网上有人给出回答,增加API SERVER配置到mandatory.yaml,于是:

  1. 在mandatory.yaml中增加了api server的配置- --apiserver-host=http://192.168.0.108:2653

  2. kubectl delete -f  mandatory.yaml

  3. kubectl create -f  mandatory.yaml

  4. kubectl get all -n ingress-nginx

    pod running,一直不ready,output:

    pod/nginx-ingress-controller-f9d7cdf74-6k8gf   0/1     Running   0          28s

  5.  kubectl logs -f pod/nginx-ingress-controller-f9d7cdf74-6k8gf -n ingress-nginx

    -------------------------------------------------------------------------------

    NGINX Ingress controller

     Release:    0.19.0

     Build:      git-05025d6

    Repository: https://github.com/kubernetes/ingress-nginx.git

    -------------------------------------------------------------------------------

    nginx version: nginx/1.15.3

    I0529 01:49:29.860351       6 main.go:191] Creating API client for http://192.168.0.108:2653

    查看日志,到这里就卡住不动了。

  6. 去node上面,查看系统日志

    May 28 21:52:49 server04 kubelet[1574]: E0528 21:52:49.180550    1574 pod_workers.go:190] Error syncing pod 89dcea82-a14e-11ea-9b5d-080027a4aa8b ("nginx-ingress-controller-f9d7cdf74-6k8gf_ingress-nginx(89dcea82-a14e-11ea-9b5d-080027a4aa8b)"), skipping: failed to "StartContainer" for "nginx-ingress-controller" with CrashLoopBackOff: "Back-off 1m20s restarting failed container=nginx-ingress-controller pod=nginx-ingress-controller-f9d7cdf74-6k8gf_ingress-nginx(89dcea82-a14e-11ea-9b5d-080027a4aa8b)"

0 回复 有任何疑惑可以回复我~
  • 192.168.0.108:2653是个啥地址了?apiserver应该是6443呀,还应该是是https的而不是http哦
    回复 有任何疑惑可以回复我~ 2020-05-30 11:45:45
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信