我尝试使用本指南在AWS上部署nginx-ingress控制器:
https://github.com/kubernetes/ingress-nginx/blob/master/deploy/README.md
在此步骤之前,一切似乎都正常工作:
kubectl patch deployment -n ingress-nginx nginx-ingress-controller --namespace ingress-nginx --type='json' --patch="$(curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/publish-service-patch.yaml)"
在运行上面的命令之前,我可以列出部署,看起来一切都很好。
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
default-http-backend 1 1 1 1 2m
nginx-ingress-controller 1 1 1 1 2m
执行命令后,nginx-ingress-controller不再可用。
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
default-http-backend 1 1 1 1 6m
nginx-ingress-controller 1 1 1 0 6m
我不确定这里发生了什么。有什么想法吗?
豆荚:
NAME READY STATUS RESTARTS AGE
default-http-backend-170366572-bz7vw 1/1 Running 0 2h
nginx-ingress-controller-2196833065-nd4jl 0/1 CrashLoopBackOff 35 2h
nginx-ingress-controller-2196833065-nd4jl记录
-------------------------------------------------------------------------------
NGINX Ingress controller
Release: 0.9.0
Build: git-6816630
Repository: https://github.com/kubernetes/ingress-nginx
-------------------------------------------------------------------------------
I0115 16:14:49.242875 6 main.go:227] Creating API client for https://100.64.0.1:443
I0115 16:14:49.250479 6 main.go:239] Running in Kubernetes Cluster version v1.7 (v1.7.11) - git (clean) commit b13f2fd682d56eab7a6a2b5a1cab1a3d2c8bdd55 - platform linux/amd64
I0115 16:14:49.252350 6 main.go:83] validated ingress-nginx/default-http-backend as the default backend
F0115 16:14:49.254160 6 main.go:93] unexpected error getting information about service ingress-nginx/ingress-nginx: services "ingress-nginx" not found
nginx-ingress-controller-2196833065-nd4jl pod说明
Name: nginx-ingress-controller-2196833065-nd4jl
Namespace: ingress-nginx
Node: ip-172-20-40-8.eu-west-2.compute.internal/172.20.40.8
Start Time: Mon, 15 Jan 2018 13:40:16 +0000
Labels: app=ingress-nginx
pod-template-hash=2196833065
Annotations: kubernetes.io/created-by={"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ReplicaSet","namespace":"ingress-nginx","name":"nginx-ingress-controller-2196833065","uid":"9ed60e34-f9f9-...
prometheus.io/port=10254
prometheus.io/scrape=true
Status: Running
IP: 100.96.1.41
Controlled By: ReplicaSet/nginx-ingress-controller-2196833065
Containers:
nginx-ingress-controller:
Container ID: docker://e6da516c1462a37785f8c3617cc8982faf0e0d4c0576600684934fbdd786a12e
Image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.9.0
Image ID: docker-pullable://quay.io/kubernetes-ingress-controller/nginx-ingress-controller@sha256:39cc6ce23e5bcdf8aa78bc28bbcfe0999e449bf99fe2e8d60984b417facc5cd4
Ports: 80/TCP, 443/TCP
Args:
/nginx-ingress-controller
--default-backend-service=$(POD_NAMESPACE)/default-http-backend
--configmap=$(POD_NAMESPACE)/nginx-configuration
--tcp-services-configmap=$(POD_NAMESPACE)/tcp-services
--udp-services-configmap=$(POD_NAMESPACE)/udp-services
--annotations-prefix=nginx.ingress.kubernetes.io
--publish-service=$(POD_NAMESPACE)/ingress-nginx
State: Waiting
Reason: CrashLoopBackOff
Last State: Terminated
Reason: Error
Exit Code: 255
Started: Mon, 15 Jan 2018 16:19:52 +0000
Finished: Mon, 15 Jan 2018 16:19:52 +0000
Ready: False
Restart Count: 36
Liveness: http-get http://:10254/healthz delay=10s timeout=1s period=10s #success=1 #failure=3
Readiness: http-get http://:10254/healthz delay=0s timeout=1s period=10s #success=1 #failure=3
Environment:
POD_NAME: nginx-ingress-controller-2196833065-nd4jl (v1:metadata.name)
POD_NAMESPACE: ingress-nginx (v1:metadata.namespace)
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-33qvw (ro)
Conditions:
Type Status
Initialized True
Ready False
PodScheduled True
Volumes:
default-token-33qvw:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-33qvw
Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.alpha.kubernetes.io/notReady:NoExecute for 300s
node.alpha.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Pulled 1m (x37 over 2h) kubelet, ip-172-20-40-8.eu-west-2.compute.internal Container image "quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.9.0" already present on machine
Normal Created 1m (x37 over 2h) kubelet, ip-172-20-40-8.eu-west-2.compute.internal Created container
Normal Started 1m (x37 over 2h) kubelet, ip-172-20-40-8.eu-west-2.compute.internal Started container
Warning BackOff 10s (x757 over 2h) kubelet, ip-172-20-40-8.eu-west-2.compute.internal Back-off restarting failed container
Warning FailedSync 10s (x757 over 2h) kubelet, ip-172-20-40-8.eu-west-2.compute.internal Error syncing pod
答案 0 :(得分:0)
看着
F0115 16:14:49.254160 6 main.go:93] unexpected error getting information about service ingress-nginx/ingress-nginx: services "ingress-nginx" not found
--publish-service=$(POD_NAMESPACE)/ingress-nginx
中定义的发布服务似乎不存在。尝试创建此服务。 this answer您可以找到特定环境的服务清单示例。
答案 1 :(得分:0)
问题确实是没有ingress-nginx服务。我遵循了这个安装指南:https://github.com/kubernetes/ingress-nginx/blob/master/deploy/README.md但是步骤的顺序是误导性的。对于其他任何人(并使用AWS),您需要按此顺序执行AWS特定步骤:
kubectl apply -f provider/aws/service-l7.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/aws/patch-configmap-l7.yaml
kubectl patch deployment -n ingress-nginx nginx-ingress-controller --type='json' --patch="$(curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/publish-service-patch.yaml)"