创建 TLS 入口资源时如何(重新)使用现有的静态 IP 地址?
How to (re) use an existent static IP address when creating a TLS Ingress Resource?
我正在使用以下配置创建(已启用 tls)入口资源:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: my-app-apis
spec:
tls:
- secretName: tls-secret
backend:
serviceName: my-web-service
servicePort: 80
每次都会提供一个新的静态 IP 地址。
是否可以重复使用现有的?
(我在 GKE 上使用 Kubernetes 运行)
您是否按照本教程创建入口对象:https://cloud.google.com/container-engine/docs/tutorials/http-balancer?
如果我没记错的话(同样我使用的是 http 而不是 https)我不得不手动为 GLBc 分配静态 IP:
https://cloud.google.com/compute/docs/reference/latest/globalForwardingRules:
Value of the reserved IP address that this forwarding rule is serving on behalf of. For global forwarding rules, the address must be a global IP; for regional forwarding rules, the address must live in the same region as the forwarding rule. If left empty (default value), an ephemeral IP from the same scope (global or regional) will be assigned.
您可以在 Ingress 的注释中指定 IP 地址(看起来您是按名称而不是 IP 地址指定的)。这仅由 GCE 控制器获取,因此不要指望它可以在 GCE/GKE.
以外的任何地方工作
https://github.com/kubernetes/contrib/blob/master/ingress/controllers/gce/controller/utils.go#L48
像这样的东西应该可以工作:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: myingress
annotations:
"kubernetes.io/ingress.global-static-ip-name": my-ip-name
spec:
...
我正在使用以下配置创建(已启用 tls)入口资源:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: my-app-apis
spec:
tls:
- secretName: tls-secret
backend:
serviceName: my-web-service
servicePort: 80
每次都会提供一个新的静态 IP 地址。 是否可以重复使用现有的?
(我在 GKE 上使用 Kubernetes 运行)
您是否按照本教程创建入口对象:https://cloud.google.com/container-engine/docs/tutorials/http-balancer?
如果我没记错的话(同样我使用的是 http 而不是 https)我不得不手动为 GLBc 分配静态 IP:
https://cloud.google.com/compute/docs/reference/latest/globalForwardingRules:
Value of the reserved IP address that this forwarding rule is serving on behalf of. For global forwarding rules, the address must be a global IP; for regional forwarding rules, the address must live in the same region as the forwarding rule. If left empty (default value), an ephemeral IP from the same scope (global or regional) will be assigned.
您可以在 Ingress 的注释中指定 IP 地址(看起来您是按名称而不是 IP 地址指定的)。这仅由 GCE 控制器获取,因此不要指望它可以在 GCE/GKE.
以外的任何地方工作https://github.com/kubernetes/contrib/blob/master/ingress/controllers/gce/controller/utils.go#L48
像这样的东西应该可以工作:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: myingress
annotations:
"kubernetes.io/ingress.global-static-ip-name": my-ip-name
spec:
...