我在将CLB升级到NLB时遇到了麻烦。我通过控制台的向导进行了手动升级,但连接无法正常工作。这个升级是必要的,所以我们可以在负载均衡器中使用静态ip。我认为它需要通过kubernetes升级,但是我的尝试失败了。
我(认为我)对这个设置的理解是,这个负载均衡器是使用Helm设置的。我还理解的是,入口(控制器)负责将http请求重定向到https。这个lb工作在第4层
apiVersion: v1
kind: Service
metadata:
labels:
app: nginx-ingress
chart: nginx-ingress-1.30.0
component: controller
heritage: Tiller
release: nginx-ingress-external
name: nginx-ingress-external-controller
namespace: kube-system
selfLink: /api/v1/namespaces/kube-system/services/nginx-ingress-external-controller
spec:
clusterIP: 172.20.41.16
externalTrafficPolicy: Cluster
ports:
- name: http
nodePort: 30854
port: 80
protocol: TCP
targetPort: http
- name: https
nodePort: 30621
port: 443
protocol: TCP
targetPort: https
selector:
app: nginx-ingress
component: controller
release: nginx-ingress-external
sessionAffinity: None
type: LoadBalancer
status:
loadBalancer:
ingress:
- hostname: xxx.region.elb.amazonaws.com
如何通过修改配置文件来执行升级?
As@Jonas在评论部分指出,用与现有的相同的选择器创建一个新的LoadBalancer
Service
可能是最快和最简单的方法。因此,我们将有两个LoadBalancer
Services
使用相同的ingress-controller
。
Services
(ingress-nginx-1-controller
和ingress-nginx-2-controller
):
$ kubectl get pod -o wide ingress-nginx-1-controller-5856bddb98-hb865
NAME READY STATUS RESTARTS AGE IP
ingress-nginx-1-controller-5856bddb98-hb865 1/1 Running 0 55m 10.36.2.8
$ kubectl get svc ingress-nginx-1-controller ingress-nginx-2-controller
NAME TYPE CLUSTER-IP EXTERNAL-IP
ingress-nginx-1-controller LoadBalancer 10.40.15.230 <PUBLIC_IP>
ingress-nginx-2-controller LoadBalancer 10.40.11.221 <PUBLIC_IP>
$ kubectl get endpoints ingress-nginx-1-controller ingress-nginx-2-controller
NAME ENDPOINTS AGE
ingress-nginx-1-controller 10.36.2.8:443,10.36.2.8:80 39m
ingress-nginx-2-controller 10.36.2.8:443,10.36.2.8:80 11m
另外,为了避免停机,我们可以首先将DNS记录更改为指向新的LoadBalancer
,在传播时间之后,我们可以安全地删除旧的LoadBalancer
Service
。