【发布时间】:2020-03-07 00:23:08
【问题描述】:
我有一个基于 MicroK8s 的本地 Kubernetes 集群,在 Ubuntu 18.04 机器上运行。
我想要实现的目标: 通常我希望将我的应用程序暴露给 DNS 名称并在本地对其进行测试。
我的设置:
我创建了以下测试部署
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-app
labels:
app: hello-app
tier: backend
version: v1
spec:
selector:
matchLabels:
app: hello-app
replicas: 2
template:
metadata:
labels:
app: hello-app
spec:
containers:
- name: hello-app
image: localhost:5000/a-local-hello-image
ports:
- containerPort: 3000
我添加了以下服务描述符:
apiVersion: v1
kind: Service
metadata:
name: hello-app
spec:
selector:
app: hello-app
ports:
- protocol: TCP
port: 3000
targetPort: 3000
现在我想在http://hello.someurl.com:3000 看到我的应用可用。
问题:除了我当前的配置之外,我还需要设置什么才能将我的应用程序映射到本地 DNS 名称?
注意:我已经阅读了the documentation,很遗憾没有帮助。我也在我的集群上enabled DNS addon。
我将不胜感激任何帮助,任何关于如何前进的方向。
【问题讨论】:
-
Ingress 可以胜任。
-
@suren 你能详细说明一下吗?我可以使用 Ingress 将我的应用程序映射到
http://localhost/hello1或http://localhost/hello2,但是如何处理 DNS 名称?
标签: kubernetes dns microk8s