【发布时间】:2022-02-18 18:50:12
【问题描述】:
我正在使用修改后的 yaml 文件安装 ingress nginx
kubectl apply -f deploy.yaml
yaml 文件只是 original deploy file,但添加了用于部署的主机端口:
ports:
- name: http
containerPort: 80
protocol: TCP
- name: https
containerPort: 443
protocol: TCP
- name: webhook
containerPort: 8443
protocol: TCP
变成:
ports:
- name: http
containerPort: 80
protocol: TCP
hostPort: 80 #<-- added
- name: https
containerPort: 443
protocol: TCP
hostPort: 443 #<-- added
- name: webhook
containerPort: 8443
protocol: TCP
hostPort: 8443 #<-- added
所以这对我有用。但我想install ingress nginx 使用 helm:
helm upgrade --install ingress-nginx ingress-nginx \
--repo https://kubernetes.github.io/ingress-nginx \
--namespace ingress-nginx --create-namespace
是否可以使用 helm (-f values.yml) 添加 hostPort 值?我需要在Deployment.spec.template.containers.ports中添加hostPort,但是我有两个问题要编写正确的values.yml文件:
values.yml
# How to access the deployment?
spec:
template:
containers:
ports: # How to add field with existing containerPort value of each element in the array?
【问题讨论】:
标签: nginx kubernetes kubernetes-helm helm3