update nginx port
Some checks failed
Build NGINX on Ubuntu / build-and-push (push) Successful in 1m5s
Build NGINX on Ubuntu / deploy-to-kubernetes (push) Failing after 6s

This commit is contained in:
huangzhiqiang 2025-06-09 17:13:42 +08:00
parent 0d579710ef
commit 7282f5bf37

View File

@ -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