diff --git a/k8s/nginx-deployment.yaml b/k8s/nginx-deployment.yaml index bbd30c4..f3caf63 100644 --- a/k8s/nginx-deployment.yaml +++ b/k8s/nginx-deployment.yaml @@ -44,7 +44,7 @@ data: keepalive_timeout 65; server { - listen 80; + listen 8080; # 修改为非特权端口 server_name localhost; location / { @@ -118,7 +118,7 @@ spec: ports: - name: http - containerPort: 80 + containerPort: 8080 # 修改为与nginx.conf中一致的端口 protocol: TCP # 环境变量 @@ -139,7 +139,7 @@ spec: livenessProbe: httpGet: path: /health - port: 80 + port: 8080 # 修改端口 initialDelaySeconds: 30 periodSeconds: 10 timeoutSeconds: 5 @@ -148,7 +148,7 @@ spec: readinessProbe: httpGet: path: /health - port: 80 + port: 8080 # 修改端口 initialDelaySeconds: 5 periodSeconds: 5 timeoutSeconds: 3 @@ -158,7 +158,7 @@ spec: startupProbe: httpGet: path: /health - port: 80 + port: 8080 # 修改端口 initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 5 @@ -216,11 +216,12 @@ metadata: labels: app: nginx spec: - type: ClusterIP + type: NodePort # 修改为NodePort类型 ports: - name: http - port: 80 - targetPort: 80 + port: 80 # 集群内部访问端口 + targetPort: 8080 # 容器端口 + nodePort: 8001 # 主机端口,必须在30000-32767范围内 protocol: TCP selector: app: nginx