我有一个在 Ubuntu 18.04 机器上运行的基于MicroK8s的本地 Kubernetes 集群。
我想要实现的目标:通常我想将我的应用程序暴露给 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 名称?
注意:我已经阅读了不幸没有帮助的文档。我还在集群上启用了 DNS 插件。
我将不胜感激任何帮助,任何关于如何前进的方向。