NGINX Ingress上的全局静态IP名称 [英] Global static IP name on NGINX Ingress

查看:519
本文介绍了NGINX Ingress上的全局静态IP名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难让我的Ingress控制器在Google Container Engine上运行.我想使用具有基本身份验证的NGINX入口控制器,并使用保留的全局静态ip名称(可以在Google Cloud Admin界面的外部IP地址"部分中进行设置).当我使用gce类时,除了基本身份验证(我认为gce类不支持)外,其他所有东西都可以正常工作,当我尝试使用nginx类时,会输入一个原始代码,Ingress Controller会启动,但是我保留了IP地址Google Cloud Admin界面将不会附加到Ingress Controller.有谁知道如何使它工作?这是我的配置文件:

I'm having difficulties getting my Ingress controller running on Google Container Engine. I want to use an NGINX Ingress Controller with Basic Auth and use a reserved global static ip name (this can be made in the External IP addresses section in the Google Cloud Admin interface). When I use the gce class everything works fine except for the Basic Auth (which I think is not supported on the gce class), anenter code hered when I try to use the nginx class the Ingress Controller launches but the IP address that I reserved in the Google Cloud Admin interface will not be attached to the Ingress Controller. Does anyone know how to get this working? Here is my config file:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: webserver
  annotations:
    kubernetes.io/ingress.global-static-ip-name: "myreservedipname"
    kubernetes.io/ingress.class: "nginx"
    ingress.kubernetes.io/auth-type: basic
    ingress.kubernetes.io/auth-realm: "Auth required"
    ingress.kubernetes.io/auth-secret: htpasswd
spec:
  tls:
    - secretName: tls
  backend:
    serviceName: webserver
    servicePort: 80

推荐答案

我找到了掌舵的解决方案.

I found a solution with helm.

helm install --name nginx-ingress stable/nginx-ingress \
      --set controller.service.loadBalancerIP=<YOUR_EXTERNAL_IP>

您应该使用external-ip,而不是您使用gcloud命名的名称.

You should use the external-ip and not the name you gave with gcloud.

此外,就我而言,我还添加了--set rbac.create=true以获得权限.

Also, in my case I also added --set rbac.create=true for permissions.

这篇关于NGINX Ingress上的全局静态IP名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆