ChatingRoomProject/k8s-deployment.yaml

33 lines
596 B
YAML
Raw Normal View History

2025-09-17 08:38:41 +00:00
apiVersion: apps/v1
kind: Deployment
metadata:
name: chatroom
spec:
replicas: 1
selector:
matchLabels:
app: chatroom
template:
metadata:
labels:
app: chatroom
spec:
containers:
- name: chatroom
image: chatroom:latest
ports:
- containerPort: 3030 # 服务器监听的端口
---
apiVersion: v1
kind: Service
metadata:
name: chatroom-service
spec:
selector:
app: chatroom
type: NodePort
ports:
- port: 3030
targetPort: 3030
nodePort: 30330 # 外部访问端口http://服务器IP:30330