gpt4 book ai didi

azure - Kubernetes - 服务类型 LoadBalancer 每次部署在 AKS 中时使用特定的 IP 地址

转载 作者:行者123 更新时间:2023-12-03 04:56:58 27 4
gpt4 key购买 nike

在 Azure 中,我使用 helm 部署服务 (type=loadbalancer)

下面是 list 文件

apiVersion: v1
kind: Service
metadata:
name: {{ template "app.fullname" . }}-service-lb
labels:
app: {{ template "app.fullname" . }}-service-lb
annotations:
service.beta.kubernetes.io/azure-load-balancer-internal: "true"
spec:
type: LoadBalancer
ports:
- port: {{.Values.appServPort}}
nodePort: {{.Values.lbPort}}
protocol: TCP
selector:
app: {{ template "app.fullname" . }}-service

是否可以告诉 kubernetes 集群每次都使用特定的 IP 作为外部 IP。每当我部署服务时?

/*-- 已编辑-- */

每次部署负载均衡器服务时,都会分配一个新的外部IP,在我的例子中,我想指定使用相同的IP,并假设该IP地址不在网络内使用。

/*---- */

我的理解是Kubernetes集群每次部署时都会分配一个外部IP,但 list 文件中没有指定。

有一个 Azure 文档,详细介绍了如何在 list 文件中使用静态 Ip 和 demo link .

最佳答案

我只是引用docs

If you would like to use a specific IP address with the internal loadbalancer, add the loadBalancerIP property to the load balancer YAMLmanifest. In this scenario, the specified IP address must reside inthe same subnet as the AKS cluster and must not already be assigned toa resource. For example, you shouldn't use an IP address in the rangedesignated for the Kubernetes subnet.

apiVersion: v1
kind: Service
metadata:
name: internal-app
annotations:
service.beta.kubernetes.io/azure-load-balancer-internal: "true"
spec:
type: LoadBalancer
loadBalancerIP: 10.240.0.25
ports:
- port: 80
selector:
app: internal-app

关于azure - Kubernetes - 服务类型 LoadBalancer 每次部署在 AKS 中时使用特定的 IP 地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66392668/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com