kubernetes 没有为 ingress-nginx 控制器创建 ELB
kubernetes not creating the ELB for ingress-nginx controller
我正在尝试设置类型为 LoadBalancer 的 ingress-nginx-controller
使用 this 配置指南。
我观察到的几个问题 -
问题 #1) 它不会在 AWS 上创建和部署 ELB。
问题#2) External-IP 状态显示为永远未决。
$ kubectl get services -n ingress-nginx
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
ingress-nginx LoadBalancer 10.108.245.210 <pending> 80:30742/TCP,443:31028/TCP 41m
我已经按照那里提到的每个步骤进行操作
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/mandatory.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/aws/service-l4.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/aws/patch-configmap-l4.yaml
这是来自 pod 的日志 -
~$ kubectl get pods -n ingress-nginx
NAME READY STATUS RESTARTS AGE
default-http-backend-7b8bdbc579-5tgd5 1/1 Running 0 5h57m
nginx-ingress-controller-766c77b7d4-w6wkk 1/1 Running 1 6h16m
$ kubectl logs -n ingress-nginx nginx-ingress-controller-766c77b7d4-w6wkk | more
-------------------------------------------------------------------------------
NGINX Ingress controller
Release: 0.21.0
Build: git-b65b85cd9
Repository: https://github.com/aledbf/ingress-nginx
-------------------------------------------------------------------------------
nginx version: nginx/1.15.6
W1228 06:50:15.592738 7 client_config.go:548] Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work.
I1228 06:50:15.593115 7 main.go:196] Creating API client for https://10.96.0.1:443
I1228 06:50:15.699540 7 main.go:240] Running in Kubernetes cluster version v1.13 (v1.13.1) - git (clean) commit eec55b9ba98609a46fee712359c7b5b365bdd920 - platfo$
m linux/amd64
I1228 06:50:16.060958 7 nginx.go:258] Starting NGINX Ingress controller
I1228 06:50:16.098387 7 event.go:221] Event(v1.ObjectReference{Kind:"ConfigMap", Namespace:"ingress-nginx", Name:"nginx-configuration", UID:"60a8d471-0a6c-11e9-9$
55-024a9b465fb2", APIVersion:"v1", ResourceVersion:"1425", FieldPath:""}): type: 'Normal' reason: 'CREATE' ConfigMap ingress-nginx/nginx-configuration
I1228 06:50:16.098548 7 event.go:221] Event(v1.ObjectReference{Kind:"ConfigMap", Namespace:"ingress-nginx", Name:"tcp-services", UID:"60acc5c1-0a6c-11e9-9a55-024$
9b465fb2", APIVersion:"v1", ResourceVersion:"1426", FieldPath:""}): type: 'Normal' reason: 'CREATE' ConfigMap ingress-nginx/tcp-services
I1228 06:50:16.103229 7 event.go:221] Event(v1.ObjectReference{Kind:"ConfigMap", Namespace:"ingress-nginx", Name:"udp-services", UID:"60ae5849-0a6c-11e9-9a55-024$
9b465fb2", APIVersion:"v1", ResourceVersion:"1428", FieldPath:""}): type: 'Normal' reason: 'CREATE' ConfigMap ingress-nginx/udp-services
I1228 06:50:17.262403 7 nginx.go:279] Starting NGINX process
I1228 06:50:17.263106 7 leaderelection.go:187] attempting to acquire leader lease ingress-nginx/ingress-controller-leader-nginx...
I1228 06:50:17.267252 7 controller.go:172] Configuration changes detected, backend reload required.
I1228 06:50:17.280698 7 leaderelection.go:196] successfully acquired lease ingress-nginx/ingress-controller-leader-nginx
I1228 06:50:17.281401 7 status.go:148] new leader elected: nginx-ingress-controller-766c77b7d4-w6wkk
I1228 06:50:18.113969 7 controller.go:190] Backend successfully reloaded.
I1228 06:50:18.114768 7 controller.go:202] Initial sync, sleeping for 1 second.
[28/Dec/2018:06:50:19 +0000]TCP200000.000
I1228 06:51:07.572896 7 event.go:221] Event(v1.ObjectReference{Kind:"ConfigMap", Namespace:"ingress-nginx", Name:"nginx-configuration", UID:"60a8d471-
0a6c-11e9-9a55-024a9b465fb2", APIVersion:"v1", ResourceVersion:"1783", FieldPath:""}): type: 'Normal' reason: 'UPDATE' ConfigMap ingress-nginx/nginx-configu
ration
I1228 06:51:07.995982 7 controller.go:172] Configuration changes detected, backend reload required.
I1228 06:51:12.846822 7 controller.go:190] Backend successfully reloaded.
[28/Dec/2018:06:51:13 +0000]TCP200000.000
W1228 10:14:17.301340 7 queue.go:130] requeuing &ObjectMeta{Name:sync status,GenerateName:,Namespace:,SelfLink:,UID:,ResourceVersion:,Generation:0,Cre
ationTimestamp:0001-01-01 00:00:00 +0000 UTC,DeletionTimestamp:<nil>,DeletionGracePeriodSeconds:nil,Labels:map[string]string{},Annotations:map[string]string
{},OwnerReferences:[],Finalizers:[],ClusterName:,Initializers:nil,}, err services "ingress-nginx" not found
W1228 10:14:17.313074 7 queue.go:130] requeuing &ObjectMeta{Name:sync status,GenerateName:,Namespace:,SelfLink:,UID:,ResourceVersion:,Generation:0,Cre
ationTimestamp:0001-01-01 00:00:00 +0000 UTC,DeletionTimestamp:<nil>,DeletionGracePeriodSeconds:nil,Labels:map[string]string{},Annotations:map[string]string
{},OwnerReferences:[],Finalizers:[],ClusterName:,Initializers:nil,}, err services "ingress-nginx" not found
W1228 10:14:17.320110 7 queue.go:130] requeuing &ObjectMeta{Name:sync status,GenerateName:,Namespace:,SelfLink:,UID:,ResourceVersion:,Generation:0,Cre
ationTimestamp:0001-01-01 00:00:00 +0000 UTC,DeletionTimestamp:<nil>,DeletionGracePeriodSeconds:nil,Labels:map[string]string{},Annotations:map[string]string
{},OwnerReferences:[],Finalizers:[],ClusterName:,Initializers:nil,}, err services "ingress-nginx" not found
<truncated>
以上错误表明服务运行不正常。没有事件也出现在描述服务输出中 -
~$ kubectl get service -n ingress-nginx
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default-http-backend ClusterIP 10.100.2.163 <none> 80/TCP 5h49m
ingress-nginx LoadBalancer 10.108.221.18 <pending> 80:32010/TCP,443:31271/TCP 170m
$kubectl describe service ingress-nginx -n ingress-nginx
Name: ingress-nginx
Namespace: ingress-nginx
Labels: app.kubernetes.io/name=ingress-nginx
app.kubernetes.io/part-of=ingress-nginx
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{"service.beta.kubernetes.io/aws-load-balancer-type":"nlb"},"label
s":{"app.k...
service.beta.kubernetes.io/aws-load-balancer-type: nlb
Selector: app.kubernetes.io/name=ingress-nginx,app.kubernetes.io/part-of=ingress-nginx
Type: LoadBalancer
IP: 10.108.221.18
Port: http 80/TCP
TargetPort: http/TCP
NodePort: http 32010/TCP
Endpoints: 10.244.0.4:80
Port: https 443/TCP
TargetPort: https/TCP
NodePort: https 31271/TCP
Endpoints: 10.244.0.4:443
Session Affinity: None
External Traffic Policy: Local
HealthCheck NodePort: 30401
Events: <none>
我知道有一个服务规范标签 externalIPs 但这里的期望是一旦创建了 ELB 实例,它就会被自动填充 -
spec:
type: LoadBalancer
externalIPs:
- {{ ingress_lb_address or vip or masterIP }}
如果我在这里遗漏了什么,请告诉我。
aws ALB、CLB、ELB 都需要一些时间来配置,最长时间为 5-10 分钟。
即使你查看 link :https://aws.amazon.com/blogs/opensource/kubernetes-ingress-aws-alb-ingress-controller/
这里是带有 ALB 的入口控制器
找到根本原因。 云提供商 集群中的所有资源都缺少标签。
~$ kubectl cluster-info dump | grep LoadBalancer
E1228 14:35:47.072444 1 core.go:76] Failed to start service controller: WARNING: no cloud provider provided, services of type LoadBalancer will fail
我正在尝试设置类型为 LoadBalancer 的 ingress-nginx-controller
使用 this 配置指南。
我观察到的几个问题 -
问题 #1) 它不会在 AWS 上创建和部署 ELB。
问题#2) External-IP 状态显示为永远未决。
$ kubectl get services -n ingress-nginx
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
ingress-nginx LoadBalancer 10.108.245.210 <pending> 80:30742/TCP,443:31028/TCP 41m
我已经按照那里提到的每个步骤进行操作
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/mandatory.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/aws/service-l4.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/aws/patch-configmap-l4.yaml
这是来自 pod 的日志 -
~$ kubectl get pods -n ingress-nginx
NAME READY STATUS RESTARTS AGE
default-http-backend-7b8bdbc579-5tgd5 1/1 Running 0 5h57m
nginx-ingress-controller-766c77b7d4-w6wkk 1/1 Running 1 6h16m
$ kubectl logs -n ingress-nginx nginx-ingress-controller-766c77b7d4-w6wkk | more
-------------------------------------------------------------------------------
NGINX Ingress controller
Release: 0.21.0
Build: git-b65b85cd9
Repository: https://github.com/aledbf/ingress-nginx
-------------------------------------------------------------------------------
nginx version: nginx/1.15.6
W1228 06:50:15.592738 7 client_config.go:548] Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work.
I1228 06:50:15.593115 7 main.go:196] Creating API client for https://10.96.0.1:443
I1228 06:50:15.699540 7 main.go:240] Running in Kubernetes cluster version v1.13 (v1.13.1) - git (clean) commit eec55b9ba98609a46fee712359c7b5b365bdd920 - platfo$
m linux/amd64
I1228 06:50:16.060958 7 nginx.go:258] Starting NGINX Ingress controller
I1228 06:50:16.098387 7 event.go:221] Event(v1.ObjectReference{Kind:"ConfigMap", Namespace:"ingress-nginx", Name:"nginx-configuration", UID:"60a8d471-0a6c-11e9-9$
55-024a9b465fb2", APIVersion:"v1", ResourceVersion:"1425", FieldPath:""}): type: 'Normal' reason: 'CREATE' ConfigMap ingress-nginx/nginx-configuration
I1228 06:50:16.098548 7 event.go:221] Event(v1.ObjectReference{Kind:"ConfigMap", Namespace:"ingress-nginx", Name:"tcp-services", UID:"60acc5c1-0a6c-11e9-9a55-024$
9b465fb2", APIVersion:"v1", ResourceVersion:"1426", FieldPath:""}): type: 'Normal' reason: 'CREATE' ConfigMap ingress-nginx/tcp-services
I1228 06:50:16.103229 7 event.go:221] Event(v1.ObjectReference{Kind:"ConfigMap", Namespace:"ingress-nginx", Name:"udp-services", UID:"60ae5849-0a6c-11e9-9a55-024$
9b465fb2", APIVersion:"v1", ResourceVersion:"1428", FieldPath:""}): type: 'Normal' reason: 'CREATE' ConfigMap ingress-nginx/udp-services
I1228 06:50:17.262403 7 nginx.go:279] Starting NGINX process
I1228 06:50:17.263106 7 leaderelection.go:187] attempting to acquire leader lease ingress-nginx/ingress-controller-leader-nginx...
I1228 06:50:17.267252 7 controller.go:172] Configuration changes detected, backend reload required.
I1228 06:50:17.280698 7 leaderelection.go:196] successfully acquired lease ingress-nginx/ingress-controller-leader-nginx
I1228 06:50:17.281401 7 status.go:148] new leader elected: nginx-ingress-controller-766c77b7d4-w6wkk
I1228 06:50:18.113969 7 controller.go:190] Backend successfully reloaded.
I1228 06:50:18.114768 7 controller.go:202] Initial sync, sleeping for 1 second.
[28/Dec/2018:06:50:19 +0000]TCP200000.000
I1228 06:51:07.572896 7 event.go:221] Event(v1.ObjectReference{Kind:"ConfigMap", Namespace:"ingress-nginx", Name:"nginx-configuration", UID:"60a8d471-
0a6c-11e9-9a55-024a9b465fb2", APIVersion:"v1", ResourceVersion:"1783", FieldPath:""}): type: 'Normal' reason: 'UPDATE' ConfigMap ingress-nginx/nginx-configu
ration
I1228 06:51:07.995982 7 controller.go:172] Configuration changes detected, backend reload required.
I1228 06:51:12.846822 7 controller.go:190] Backend successfully reloaded.
[28/Dec/2018:06:51:13 +0000]TCP200000.000
W1228 10:14:17.301340 7 queue.go:130] requeuing &ObjectMeta{Name:sync status,GenerateName:,Namespace:,SelfLink:,UID:,ResourceVersion:,Generation:0,Cre
ationTimestamp:0001-01-01 00:00:00 +0000 UTC,DeletionTimestamp:<nil>,DeletionGracePeriodSeconds:nil,Labels:map[string]string{},Annotations:map[string]string
{},OwnerReferences:[],Finalizers:[],ClusterName:,Initializers:nil,}, err services "ingress-nginx" not found
W1228 10:14:17.313074 7 queue.go:130] requeuing &ObjectMeta{Name:sync status,GenerateName:,Namespace:,SelfLink:,UID:,ResourceVersion:,Generation:0,Cre
ationTimestamp:0001-01-01 00:00:00 +0000 UTC,DeletionTimestamp:<nil>,DeletionGracePeriodSeconds:nil,Labels:map[string]string{},Annotations:map[string]string
{},OwnerReferences:[],Finalizers:[],ClusterName:,Initializers:nil,}, err services "ingress-nginx" not found
W1228 10:14:17.320110 7 queue.go:130] requeuing &ObjectMeta{Name:sync status,GenerateName:,Namespace:,SelfLink:,UID:,ResourceVersion:,Generation:0,Cre
ationTimestamp:0001-01-01 00:00:00 +0000 UTC,DeletionTimestamp:<nil>,DeletionGracePeriodSeconds:nil,Labels:map[string]string{},Annotations:map[string]string
{},OwnerReferences:[],Finalizers:[],ClusterName:,Initializers:nil,}, err services "ingress-nginx" not found
<truncated>
以上错误表明服务运行不正常。没有事件也出现在描述服务输出中 -
~$ kubectl get service -n ingress-nginx
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default-http-backend ClusterIP 10.100.2.163 <none> 80/TCP 5h49m
ingress-nginx LoadBalancer 10.108.221.18 <pending> 80:32010/TCP,443:31271/TCP 170m
$kubectl describe service ingress-nginx -n ingress-nginx
Name: ingress-nginx
Namespace: ingress-nginx
Labels: app.kubernetes.io/name=ingress-nginx
app.kubernetes.io/part-of=ingress-nginx
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{"service.beta.kubernetes.io/aws-load-balancer-type":"nlb"},"label
s":{"app.k...
service.beta.kubernetes.io/aws-load-balancer-type: nlb
Selector: app.kubernetes.io/name=ingress-nginx,app.kubernetes.io/part-of=ingress-nginx
Type: LoadBalancer
IP: 10.108.221.18
Port: http 80/TCP
TargetPort: http/TCP
NodePort: http 32010/TCP
Endpoints: 10.244.0.4:80
Port: https 443/TCP
TargetPort: https/TCP
NodePort: https 31271/TCP
Endpoints: 10.244.0.4:443
Session Affinity: None
External Traffic Policy: Local
HealthCheck NodePort: 30401
Events: <none>
我知道有一个服务规范标签 externalIPs 但这里的期望是一旦创建了 ELB 实例,它就会被自动填充 -
spec:
type: LoadBalancer
externalIPs:
- {{ ingress_lb_address or vip or masterIP }}
如果我在这里遗漏了什么,请告诉我。
aws ALB、CLB、ELB 都需要一些时间来配置,最长时间为 5-10 分钟。
即使你查看 link :https://aws.amazon.com/blogs/opensource/kubernetes-ingress-aws-alb-ingress-controller/
这里是带有 ALB 的入口控制器
找到根本原因。 云提供商 集群中的所有资源都缺少标签。
~$ kubectl cluster-info dump | grep LoadBalancer
E1228 14:35:47.072444 1 core.go:76] Failed to start service controller: WARNING: no cloud provider provided, services of type LoadBalancer will fail