在 GKE 专用集群上创建入口资源时超时

Timeout when creating ingress resource on GKE private cluster

创建了一个 GKE 集群,为互联网连接设置了 cloud-nat。然后我部署了 kubernetes ingress-nginx kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/cloud/deploy.yaml.

到这里一切都很好,但是当我尝试部署 ingress resource 时,我得到了这个 Error from server (Timeout): error when creating "manifests/backend/service/be-nginx-ingress-serivce.yaml": Timeout: request did not complete within requested timeout 30s

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ingress-resource
  namespace: sap
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  tls:
    - hosts:
      - mywebname.com
      secretName: ingress-tls
  rules:
    - host: mywebname.com
      http:
        paths:
        - path: /
          backend:
            serviceName: app
            servicePort: 5000
        - path: /v1
          backend:
            serviceName: web
            servicePort: 8081

我的清单在 public GKE 上 运行 没问题,但今天我将其切换为私有,但我遇到了这个问题,这是我第一次使用 VPC,如有任何帮助或指导,我们将不胜感激,谢谢

我很确定这是防火墙的问题。你遵守文件了吗?

https://kubernetes.github.io/ingress-nginx/deploy/#gce-gke

For private clusters, you will need to either add an additional firewall rule that allows master nodes access port 8443/tcp on worker nodes, or change the existing rule that allows access to ports 80/tcp, 443/tcp and 10254/tcp to also allow access to port 8443/tcp.

https://cloud.google.com/kubernetes-engine/docs/how-to/private-clusters#add_firewall_rules

gcloud compute firewall-rules create firewall-rule-name \
    --action ALLOW \
    --direction INGRESS \
    --source-ranges master-CIDR-block \
    --rules protocol:port \
    --target-tags target