微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

k8s部署ingress-nginx报错拍错

  不是ingress-Nginx不成功出现错误提示

kubectl describe pod nginx-ingress-controller-6ffc8fdf96-xtg6n -n ingress-Nginx

 

 normal   Scheduled  <unkNown>         default-scheduler      Successfully assigned ingress-Nginx/nginx-ingress-controller-6ffc8fdf96-xtg6n to 192.168.1.12
  normal   Pulled     21s               kubelet, 192.168.1.12  Container image "quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.30.0" already present on machine
  normal   Created    21s               kubelet, 192.168.1.12  Created container nginx-ingress-controller
  normal   Started    20s               kubelet, 192.168.1.12  Started container nginx-ingress-controller
  Warning  Unhealthy  5s (x2 over 15s)  kubelet, 192.168.1.12  Readiness probe Failed: Get http://192.168.1.12:10254/healthz: dial tcp 192.168.1.12:10254: connect: connection refused
  Warning  Unhealthy  2s                kubelet, 192.168.1.12  Liveness probe Failed: Get http://192.168.1.12:10254/healthz: dial tcp 192.168.1.12:10254: connect: connection refused

   对应node的kubelet日志

systemctl status kube-proxy -l

   报错如下

kuberuntime_container.go:490] preStop hook for container "nginx-ingress-controller" Failed: command '/wait-shutdown' exited with 137:

 

 

 

 

   查看pod日志

# kubectl logs nginx-ingress-controller-6ffc8fdf96-xtg6n -n ingress-Nginx
-------------------------------------------------------------------------------
Nginx Ingress controller
  Release:       0.30.0
  Build:         git-7e65b90c4
  Repository:    https://github.com/kubernetes/ingress-Nginx
  Nginx version: Nginx/1.17.8

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

W0430 09:48:42.198239       6 flags.go:260] SSL certificate chain completion is disabled (--enable-ssl-chain-completion=false)
W0430 09:48:42.198310       6 client_config.go:543] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.
I0430 09:48:42.198533       6 main.go:193] Creating API client for https://10.0.0.1:443

   判断是10.0.0.443有问题

  node上telnet失败

# telnet 10.0.0.1 443
Trying 10.0.0.1...

   解决方法修改kube-proxy配置把流量转发该成ipvs模式

cat /opt/kubernetes/cfg/kube-proxy

 

# cat /opt/kubernetes/cfg/kube-proxy
KUBE_PROXY_OPTS="--logtostderr=false \
--log-dir=/opt/kubernetes/logs/kube-proxy \
--v=4 \
--hostname-override=192.168.1.12 \
--cluster-cidr=10.0.0.0/24 \
--proxy-mode=ipvs \
--masquerade-all=true \
--kubeconfig=/opt/kubernetes/cfg/kube-proxy.kubeconfig"

   增加内容

 

   重启kube-proxy

  重新不是ingress-Nginx即可

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐