简体   繁体   English

在AWS上部署NGINX入口控制器

[英]Deploying an NGINX Ingress Controller on AWS

I have tried to deploy an nginx-ingress controller on AWS using this guide: 我尝试使用此指南在AWS上部署Nginx-ingress控制器:

https://github.com/kubernetes/ingress-nginx/blob/master/deploy/README.md

Everything seems to be working fine until this step: 在执行此步骤之前,一切似乎都工作正常:

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)"

Before I run the above command I can list the deployments and all looks good. 在运行上述命令之前,我可以列出所有部署,并且看起来都不错。

NAME                       DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
default-http-backend       1         1         1            1           2m
nginx-ingress-controller   1         1         1            1           2m

After I execute the command the nginx-ingress-controller is no longer available. 执行命令后,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

I'm not sure what is going on here. 我不确定这是怎么回事。 Any ideas? 有任何想法吗?

The pods: 豆荚:

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

The nginx-ingress-controller-2196833065-nd4jl logs 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 description nginx-ingress-controller-2196833065-nd4jl吊舱说明

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

Looking at 看着

F0115 16:14:49.254160       6 main.go:93] unexpected error getting information about service ingress-nginx/ingress-nginx: services "ingress-nginx" not found

It seems your publish service defined in --publish-service=$(POD_NAMESPACE)/ingress-nginx does not exist. 似乎您在--publish-service=$(POD_NAMESPACE)/ingress-nginx中定义的发布服务不存在。 Try creating this service. 尝试创建此服务。 Here you can find examples of service manifests for particular environments. 在这里,您可以找到特定环境的服务清单示例。

The problem was indeed that there was no ingress-nginx service. 问题的确是没有ingress-nginx服务。 I followed this installation guide: https://github.com/kubernetes/ingress-nginx/blob/master/deploy/README.md but the order of the steps was misleading. 我遵循了此安装指南: https : //github.com/kubernetes/ingress-nginx/blob/master/deploy/README.md,但步骤顺序具有误导性。 For anyone else doing this (and using AWS) you need to do the AWS specific steps in this order: 对于其他这样做的人(并使用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)"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 具有NGINX入口控制器和SSL终止的AWS上的Kubernetes - Kubernetes on AWS with NGINX ingress controller and SSL termination AWS - x-real-ip 是 nginx-ingress-controller 的 ip - AWS - x-real-ip is ip of nginx-ingress-controller 只有“/”适用于 AWS EKS 中的 NGINX 入口控制器和 ALB - Only the '/' works with NGINX ingress controller and ALB in AWS EKS Aws 入口控制器设置 - Aws ingress controller setup AWS 上的 ALB 入口控制器 - ALB Ingress Controller on AWS 单个集群中的 AWS ALB 入口和 Nginx 入口 - AWS ALB ingress and Nginx ingress in a single cluster Ingress资源与Kubernetes上的NGINX入口控制器 - Ingress resource vs NGINX ingress controller on Kubernetes 如何将 HTTP 重定向到 HTTPS 与 Nginx 入口 Z9BBF373797BF7CF7BA62C80023 由 AWS Manager 证书管理,AWS NELB23 证书? - How to redirect HTTP to HTTPS with Nginx Ingress Controller, AWS NLB and TLS certificate managed by AWS Certificate Manager? 无法访问在 AWS 上运行的 Kubernetes 集群上通过 nginx 入口控制器公开的 Spring Boot 微服务 - Unable to access Spring Boot microservice exposed via nginx ingress controller on Kubernetes cluster running on AWS AWS EKS 上 Nginx 入口控制器背后的 Asp.net Core 得到“502 Bad Gateway” - Asp.net Core behind a Nginx Ingress Controller on AWS EKS got "502 Bad Gateway"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM