问题描述
我已经设置了AKS集群,现在正尝试连接到它.我的部署YAML在这里:
I've set-up an AKS cluster and am now trying to connect to it. My deployment YAML is here:
apiVersion: v1
kind: Pod
spec:
containers:
- name: dockertest20190205080020
image: dockertest20190205080020.azurecr.io/dockertest
ports:
- containerPort: 443
metadata:
name: my-test
如果我运行仪表板,则会得到以下提示:
If I run the dashboard, I get this:
看起来应该告诉我外部端点,但不是.我有一个理论,这是因为Yaml文件仅部署了Pod,而Pod在某种程度上无法公开终结点-是这种情况,如果是这样,为什么?否则,如何找到该端点?
Which looks like it should be telling me the external endpoint, but isn't. I have a theory that this is because the Yaml file is only deploying a Pod, which is in some way not able to expose an endpoint - is that the case and if so, why? Otherwise, how can I find this endpoint?
推荐答案
那不是它的工作原理,您需要阅读有关Kubernetes的基本概念. Pod只是容器,要暴露需要创建服务的Pod(需要标签),要暴露外部的Pod,需要将服务类型设置为LoadBalancer.您可能想使用部署而不是Pod,这更容易\可靠.
Thats not how that works, you need to read up on basic kubernetes concept. Pods are only container, to expose pods you need to create services (and you need labels), to expose pods externally you need to set service type to LoadBalancer. You probably want to use deployments instead of pods, its a lot easier\reliable.
https://kubernetes.io/docs/concepts/services-networking/服务/
https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
因此,简而言之,您需要在广告连播中添加标签,并使用与您的广告连播标签匹配的选择器创建类型为负载均衡器的服务
so in short, you need to add labels to your pod and create a service of type load balancer with selectors that match your pods labels
kind: Service
apiVersion: v1
metadata:
name: my-service
spec:
selector:
app: MyApp
ports:
- protocol: TCP
port: 80
targetPort: 443
type: LoadBalancer
这篇关于查找AKS集群的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!