GKE 中缺少 Kubernetes 入口地址
我已经从 ingress 安装了所需的 K8 控制器,但是在执行 kubectl delete all --all 后,它似乎删除了一些我不应该删除的东西。
缺少地址的输出:
my-ingress <none> * 80 15m
INgress 文件:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: my-ingress
spec:
rules:
- http:
paths:
- path: /*
pathType: ImplementationSpecific
backend:
service:
name: questionbankrestapi
port:
number: 80
- path: /discounted
pathType: ImplementationSpecific
backend:
service:
name: questionbankrestapi
port:
number: 80
我已经使用以下方式安装了 GKE 控制器:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.1.1/deploy/static/provider/cloud/deploy.yaml
而且我还完成了绑定:
kubectl create clusterrolebinding cluster-admin-binding --clusterrole cluster-admin --user $(gcloud config get-value account)
这是描述输出:
Name: my-ingress
Labels: <none>
Namespace: default
Address:
Default backend: default-http-backend:80 (10.4.0.6:8080)
Rules:
Host Path Backends
---- ---- --------
*
/* questionbankrestapi:80 (10.4.0.10:4000)
/discounted questionbankrestapi:80 (10.4.0.10:4000)
Annotations: <none>
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Sync 84s (x4 over 20m) loadbalancer-controller Scheduled for sync
Warning Sync 83s (x20 over 19m) loadbalancer-controller Error syncing to GCP: error running backend syncing routine: error ensuring health check: googleapi: Error 400: Invalid value for field 'resource.timeoutSec': '15'. TimeoutSec should be less than checkIntervalSec., invalid
Kubernetes 版本:
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.3", GitCommit:"816c97ab8cff8a1c72eccca1026f7820e93e0d25", GitTreeState:"clean", BuildDate:"2022-01-25T21:25:17Z", GoVersion:"go1.17.6", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.6-gke.1503", GitCommit:"2c7bbda09a9b7ca78db230e099cf90fe901d3df8", GitTreeState:"clean", BuildDate:"2022-02-18T03:17:45Z", GoVersion:"go1.16.9b7", Compiler:"gc", Platform:"linux/amd64"}
WARNING: version difference between client (1.23) and server (1.21) exceeds the supported minor version skew of +/-1
Ran the Ready Check,似乎也可以:
+]ping ok
[+]log ok
[+]etcd ok
[+]informer-sync ok
[+]poststarthook/start-kube-apiserver-admission-initializer ok
[+]poststarthook/generic-apiserver-start-informers ok
[+]poststarthook/priority-and-fairness-config-consumer ok
[+]poststarthook/priority-and-fairness-filter ok
[+]poststarthook/start-apiextensions-informers ok
[+]poststarthook/start-apiextensions-controllers ok
[+]poststarthook/crd-informer-synced ok
[+]poststarthook/bootstrap-controller ok
[+]poststarthook/rbac/bootstrap-roles ok
[+]poststarthook/scheduling/bootstrap-system-priority-classes ok
[+]poststarthook/priority-and-fairness-config-producer ok
[+]poststarthook/start-cluster-authentication-info-controller ok
[+]poststarthook/aggregator-reload-proxy-client-cert ok
[+]poststarthook/start-kube-aggregator-informers ok
[+]poststarthook/apiservice-registration-controller ok
[+]poststarthook/apiservice-status-available-controller ok
[+]poststarthook/kube-apiserver-autoregistration ok
[+]autoregister-completion ok
[+]poststarthook/apiservice-openapi-controller ok
[+]shutdown ok
readyz check passed
I have already install the K8 controllers needed from ingress, however after executing kubectl delete all --all
it seem to have deleted something i should have not deleted.
Output where the address is missing:
my-ingress <none> * 80 15m
INgress file:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: my-ingress
spec:
rules:
- http:
paths:
- path: /*
pathType: ImplementationSpecific
backend:
service:
name: questionbankrestapi
port:
number: 80
- path: /discounted
pathType: ImplementationSpecific
backend:
service:
name: questionbankrestapi
port:
number: 80
I have installed GKE Controllers using:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.1.1/deploy/static/provider/cloud/deploy.yaml
And I have also done the bindings:
kubectl create clusterrolebinding cluster-admin-binding --clusterrole cluster-admin --user $(gcloud config get-value account)
Here is the describe ing output:
Name: my-ingress
Labels: <none>
Namespace: default
Address:
Default backend: default-http-backend:80 (10.4.0.6:8080)
Rules:
Host Path Backends
---- ---- --------
*
/* questionbankrestapi:80 (10.4.0.10:4000)
/discounted questionbankrestapi:80 (10.4.0.10:4000)
Annotations: <none>
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Sync 84s (x4 over 20m) loadbalancer-controller Scheduled for sync
Warning Sync 83s (x20 over 19m) loadbalancer-controller Error syncing to GCP: error running backend syncing routine: error ensuring health check: googleapi: Error 400: Invalid value for field 'resource.timeoutSec': '15'. TimeoutSec should be less than checkIntervalSec., invalid
Kubernetes Version:
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.3", GitCommit:"816c97ab8cff8a1c72eccca1026f7820e93e0d25", GitTreeState:"clean", BuildDate:"2022-01-25T21:25:17Z", GoVersion:"go1.17.6", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.6-gke.1503", GitCommit:"2c7bbda09a9b7ca78db230e099cf90fe901d3df8", GitTreeState:"clean", BuildDate:"2022-02-18T03:17:45Z", GoVersion:"go1.16.9b7", Compiler:"gc", Platform:"linux/amd64"}
WARNING: version difference between client (1.23) and server (1.21) exceeds the supported minor version skew of +/-1
Ran the Ready Check, seems ok too:
+]ping ok
[+]log ok
[+]etcd ok
[+]informer-sync ok
[+]poststarthook/start-kube-apiserver-admission-initializer ok
[+]poststarthook/generic-apiserver-start-informers ok
[+]poststarthook/priority-and-fairness-config-consumer ok
[+]poststarthook/priority-and-fairness-filter ok
[+]poststarthook/start-apiextensions-informers ok
[+]poststarthook/start-apiextensions-controllers ok
[+]poststarthook/crd-informer-synced ok
[+]poststarthook/bootstrap-controller ok
[+]poststarthook/rbac/bootstrap-roles ok
[+]poststarthook/scheduling/bootstrap-system-priority-classes ok
[+]poststarthook/priority-and-fairness-config-producer ok
[+]poststarthook/start-cluster-authentication-info-controller ok
[+]poststarthook/aggregator-reload-proxy-client-cert ok
[+]poststarthook/start-kube-aggregator-informers ok
[+]poststarthook/apiservice-registration-controller ok
[+]poststarthook/apiservice-status-available-controller ok
[+]poststarthook/kube-apiserver-autoregistration ok
[+]autoregister-completion ok
[+]poststarthook/apiservice-openapi-controller ok
[+]shutdown ok
readyz check passed
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您运行
kubectl delete all --all
命令,那么您就删除了当前命名空间中的所有内容,例如 Pod、Services 和 Statefulsets,但是 RoleBindings、ServiceAccounts 和NetworkPolicies 不是。因此,我建议您验证您的负载均衡器服务和您的 <一个href="https://cloud.google.com/load-balancing/docs/health-checks?_ga=2.150253750.-1418735072.1639493729&_gac=1.582 31512.1644874296.Cj0KCQiAmKiQBhClarisAKtSj-lB_WBXa-9wl6d_L82biDdigqRuRUo73tv-hc_H_VnoZyQZsQoCb3MaAix5EALw_wcB#list-hcs" rel="nofollow noreferrer">健康检查时间值设置为
15秒
;这是默认值。 如果是,请设置为60秒,因为超时值必须小于或等于间隔。此外,如果入口已被删除;这也可能是服务 IP 不显示的原因。您可以在服务和服务中查看此内容。 Kubernetes Engine GCP 控制台菜单中的 ingress 选项,因此如果已删除,请尝试重新创建入口 从头开始。
下面附上如何正确设置后端配置健康检查的示例:
If you ran the
kubectl delete all --all
command then you deleted everything from your current namespace like Pods, Services and Statefulsets, however RoleBindings, ServiceAccounts and NetworkPolicies were not.For that reason, I suggest you verify if your Load Balancer services and your Health Check time values were set to
15 seconds
; this is the default value. If yes, please set it to 60 seconds because the value of the timeout must be less than or equal to the interval. Additionally, if the ingress was deleted; this could also be the cause for the service IP not to be shown.You can review this in the Services & ingress option in the Kubernetes Engine GCP console menu, so if this was deleted please try to recreate the ingress from scratch.
Attached below is an example on how to correctly set the backend config health check: