[英]GCE LoadBalancer not being created despite ingress resource creation
I am installing the official jenkins
helm chart on GKE.我正在 GKE 上安装官方
jenkins
helm chart 。
I am enabling Ingress
therefore the corresponding template should be applied and the resource created.我正在启用
Ingress
因此应应用相应的模板并创建资源。
According to the official GKE documentation :根据官方 GKE 文档:
When you create the Ingress, the GKE ingress controller creates and configures an HTTP(S) load balancer according to the information in the Ingress and the associated Services.
当您创建 Ingress 时,GKE Ingress 控制器会根据 Ingress 和关联服务中的信息创建和配置 HTTP(S) 负载均衡器。 Also, the load balancer is given a stable IP address that you can associate with a domain name.
此外,负载均衡器会获得一个稳定的 IP 地址,您可以将其与域名相关联。
However, this does not happen in my case;但是,在我的情况下不会发生这种情况。 the ingress does not get an external IP associated with it:
入口没有获得与之关联的外部 IP:
▶ k get ingress --all-namespaces
NAMESPACE NAME HOSTS ADDRESS PORTS AGE
jenkins jenkins-inception * 80 82s
Here is the actual Ingress
resource:这是实际的
Ingress
资源:
▶ k get ingress --all-namespaces -o yaml
apiVersion: v1
items:
- apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
creationTimestamp: "2020-01-24T21:20:49Z"
generation: 1
labels:
app.kubernetes.io/component: jenkins-master
app.kubernetes.io/instance: jenkins-inception
app.kubernetes.io/managed-by: Tiller
app.kubernetes.io/name: jenkins
helm.sh/chart: jenkins-1.9.16
name: jenkins-inception
namespace: jenkins
resourceVersion: "15741661"
selfLink: /apis/extensions/v1beta1/namespaces/jenkins/ingresses/jenkins-inception
uid: 6461793e-3eef-11ea-a0a5-42010a790807
spec:
rules:
- http:
paths:
- backend:
serviceName: jenkins-inception
servicePort: 8080
path: /jenkins
status:
loadBalancer: {}
kind: List
metadata:
resourceVersion: ""
selfLink: ""
Why is that?这是为什么?
Have tried both nginx
and gce
in kubernetes.io/ingress.class
annotation values.曾经尝试都
nginx
和gce
在kubernetes.io/ingress.class
标注值。
edit_1 : it seems that the HTTP Load Balancing
Add On is enabled. edit_1 :似乎启用了
HTTP Load Balancing
Add On。
The weirdest part however is the following:然而,最奇怪的部分是以下内容:
▶ k describe ingress jenkins-inception -n jenkins
Error from server (NotFound): the server could not find the requested resource
~
▶ k get ingress jenkins-inception -n jenkins
NAME HOSTS ADDRESS PORTS AGE
jenkins-inception * 80 11h
edit_2 :编辑_2 :
Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.0", GitCommit:"e8462b5b5dc2584fdcd18e6bcfe9f1e4d970a529", GitTreeState:"clean", BuildDate:"2019-06-19T16:40:16Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"13+", GitVersion:"v1.13.11-gke.14", GitCommit:"56d89863d1033f9668ddd6e1c1aea81cd846ef88", GitTreeState:"clean", BuildDate:"2019-11-07T19:12:22Z", GoVersion:"go1.12.11b4", Compiler:"gc", Platform:"linux/amd64"}
edit_3 : After addressing the kubectl
compatibility issue, it turns out no events are generated by the ingress edit_3 : 在解决
kubectl
兼容性问题后,结果证明 ingress 没有生成任何事件
▶ k describe ingress jenkins-inception -n jenkins
Name: jenkins-inception
Namespace: jenkins
Address:
Default backend: default-http-backend:80 (10.8.32.33:8080)
Rules:
Host Path Backends
---- ---- --------
*
/jenkins jenkins-inception:8080 (10.8.33.87:8080)
Annotations:
kubernetes.io/ingress.class: nginx
Events: <none>
Is there a command line to list enabled add-ons on a cluster?是否有命令行列出集群上已启用的附加组件?
edit_4 : About the add ons.. edit_4 :关于附加组件..
▶ gcloud container clusters describe inception-cluster --zone us-east4-b | grep -i add -A 6
addonsConfig:
horizontalPodAutoscaling: {}
httpLoadBalancing: {}
kubernetesDashboard:
disabled: true
networkPolicyConfig:
disabled: true
edit_5 : After enabling the actual GCE ingress with the correct annotation as pointed out in comments by @Arghya Sadhu, I see the following error in the ingress description edit_5 :使用@Arghya Sadhu 评论中指出的正确注释启用实际 GCE 入口后,我在入口描述中看到以下错误
Warning Translate 2s (x11 over 7s) loadbalancer-controller error while evaluating the ingress spec: service "jenkins/jenkins-inception" is type "ClusterIP", expected "NodePort" or "LoadBalancer"
警告在评估入口规范时翻译 2s(x11 over 7s)负载均衡器错误:服务“jenkins/jenkins-inception”的类型为“ClusterIP”,预期为“NodePort”或“LoadBalancer”
However this contradicts with the following recommendation from the official jenkins
helm charts:然而,这与官方
jenkins
helm charts 的以下建议相矛盾:
# For minikube, set this to NodePort, elsewhere use LoadBalancer
# Use ClusterIP if your setup includes ingress controller
edit_6 : The ingress managed to get a public IP: edit_6 :入口设法获得公共 IP:
spec:
rules:
- http:
paths:
- backend:
serviceName: jenkins-inception
servicePort: 8080
path: /jenkins
status:
loadBalancer:
ingress:
- ip: 12.234.543.111
However I am unable to access the following paths:但是我无法访问以下路径:
https://12.234.543.111/jenkins
http://12.234.543.111/jenkins
https://12.234.543.111
http://12.234.543.111
edit_7 : The yaml
of the jenkins-inception
service edit_7 :
jenkins-inception
服务的yaml
▶ k get svc jenkins-inception -o yaml
apiVersion: v1
kind: Service
metadata:
creationTimestamp: "2020-01-25T12:40:14Z"
labels:
app.kubernetes.io/component: jenkins-master
app.kubernetes.io/instance: jenkins-inception
app.kubernetes.io/managed-by: Tiller
app.kubernetes.io/name: jenkins
helm.sh/chart: jenkins-1.9.16
name: jenkins-inception
namespace: jenkins
resourceVersion: "16000964"
selfLink: /api/v1/namespaces/jenkins/services/jenkins-inception
uid: d5bfd760-3f6f-11ea-a0a5-42010a790807
spec:
clusterIP: 10.8.59.184
externalTrafficPolicy: Cluster
ports:
- name: http
nodePort: 30361
port: 8080
protocol: TCP
targetPort: 8080
selector:
app.kubernetes.io/component: jenkins-master
app.kubernetes.io/instance: jenkins-inception
sessionAffinity: None
type: NodePort
status:
loadBalancer: {}
Run describe on the Ingress.在 Ingress 上运行 describe。 If you see create/add events, you have an Ingress controller running in the cluster, otherwise, you probably have the HttpLoadBalancing(GKE Ingress Controller) add-on disabled on your GKE cluster
如果您看到创建/添加事件,则说明集群中有一个 Ingress 控制器正在运行,否则,您可能在 GKE 集群上禁用了 HttpLoadBalancing(GKE Ingress Controller) 插件
Edit1:编辑1:
You have version incompatibility between kubernetes server and kubectl.您在 kubernetes 服务器和 kubectl 之间存在版本不兼容。 You can check both client and server version by running below command.
您可以通过运行以下命令来检查客户端和服务器版本。 Check this issue for details.
检查此问题以获取详细信息。
kubectl version
Edit2:编辑2:
You either should not have the annotation kubernetes.io/ingress.class
or if you have it needs be gce kubernetes.io/ingress.class: gce
你要么不应该有注释
kubernetes.io/ingress.class
或者如果你有它需要是kubernetes.io/ingress.class: gce
Edit3:编辑3:
As per the google cloud doc the service type for jenkins-inception service needs to be of type NodePort根据谷歌云文档,jenkins-inception 服务的服务类型需要是 NodePort 类型
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.