我正在尝试在我的kubernetes(不打算使用云供应商)集群中安装nginx入口控制器,但它没有监听端口80,这是我的Deployment yaml
kind: Deployment
metadata:
name: ingress-deployment
labels:
app: ingress
spec:
replicas: 1
selector:
matchLabels:
app: nginx-ingress
template:
metadata:
labels:
app: nginx-ingress
spec:
containers:
- name: nginx-ingress-container
image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.21.0
args:
- /nginx-ingress-controller
- --publish-service=$(POD_NAMESPACE)/nginx-ingress-lb
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
ports:
- name: http
containerPort: 80
- name: https
containerPort: 443
服务定义文件是
apiVersion: v1
kind: Service
metadata:
name: ingress-service
spec:
selector:
app: ingress
type: NodePort
ports:
- port: 80
targetPort: 80
protocol: TCP
name: http
- port: 443
targetPort: 443
protocol: TCP
name: https
入口Pod的IP为“ 10.244.1.23”,但未连接到端口80。我们是否应该修改部署文件上的任何内容?