[英]Kubernetes Ingress Address is missing in GKE
我已经安装了入口所需的 K8 控制器,但是在执行kubectl delete all --all
之后,它似乎删除了一些我不应该删除的东西。
Output 缺少地址:
my-ingress <none> * 80 15m
入口文件:
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)
这是 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
Kube.netes 版本:
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
运行就绪检查,似乎也不错:
+]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
如果你运行了kubectl delete all --all
命令,那么你就删除了当前命名空间中的所有内容,例如 Pod、Services 和 Statefulsets,但是RoleBindings 、 ServiceAccounts和NetworkPolicies没有。
出于这个原因,我建议您验证您的负载均衡器服务和健康检查时间值是否设置为15 seconds
; 这是默认值。 如果是,请将其设置为 60 秒,因为超时值必须小于或等于 interval 。 此外,如果入口被删除; 这也可能是服务 IP 未显示的原因。
您可以在Kube.netes 引擎GCP 控制台菜单的服务和入口选项中查看它,因此如果它被删除,请尝试从头开始重新创建入口。
下面附上一个示例,说明如何正确设置后端配置健康检查:
healthCheck:
checkIntervalSec: 10
timeoutSec: 10
port: 80
requestPath: /discounted
type: HTTPS
securityPolicy:
name: your-policy-restricted
sessionAffinity:
affinityType: NONE
timeoutSec: 60
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.