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

时间:2020-05-21 16:43:43

标签: nginx kubernetes google-cloud-platform google-kubernetes-engine kubernetes-ingress

创建了一个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

我的清单在公共G​​KE上运行良好,但是今天我将其切换为私有,并且遇到了这个问题,这是我第一次使用VPC,感谢您的任何帮助或指导,谢谢

1 个答案:

答案 0 :(得分:2)

我很确定这是防火墙之类的东西。您遵循文件了吗?

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

对于专用群集,您将需要添加其他防火墙规则以允许主节点访问工作节点上的端口8443 / tcp,或更改现有规则以允许访问端口80 / tcp,443 / tcp和10254 / tcp还允许访问端口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