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