gpt4 book ai didi

azure - Azure 上端口 443 的 Kubernetes list

转载 作者:行者123 更新时间:2023-12-02 12:20:20 25 4
gpt4 key购买 nike

与 Azure 上的 Kubernetes list 作斗争。我有一个简单的 API 应用程序在端口 443 (https) 上运行。我只想在带有负载均衡器的 kubernetes 集群中运行并复制此应用程序 3 次。

Kubernetes 集群:

Kubernetes cluster figure

我的 list 文件:

apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: apiApp
spec:
replicas: 3
template:
metadata:
labels:
app: apiApp
spec:
containers:
- name: apiApp
image: {image name on Registry}
ports:
- containerPort: 443
hostPort: 443
---
apiVersion: v1
kind: Service
metadata:
name: apiApp
spec:
type: LoadBalancer
ports:
- name: https
port: 443
targetPort: 443
selector:
app: apiApp

在上面的 list 中,负载均衡器似乎没有在容器内的端口 443 上找到应用程序。

1) 如何创建此 list 以将负载均衡器链接到容器的端口 443,并在端口 443 上将负载均衡器暴露给外界。

2)多集群环境中的 list 是什么样子的(与上述条件相同)

最佳答案

对于您的问题,我按照文档 Deploy an Azure Kubernetes Service (AKS) cluster 使用负载均衡器进行了测试.

此示例只有 1 个 Pod,因此我使用命令 kubectlscale --replicas=3deployment/azure-vote-front 将 Pod 扩展到 3 个。有关规模和负载均衡器的 yaml 文件将如下面的屏幕截图所示。

enter image description here enter image description here

当集群完成后,我可以通过 Web 浏览从 Internet 访问该服务。您可以使用命令 az aks browse进入 Kubernets 仪表板以获取 Kubernets 集群的概述。

更新

Azure Kubernets 集群只是一个如下所示的资源组,负载均衡器也是如此: enter image description here

关于azure - Azure 上端口 443 的 Kubernetes list ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51481138/

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