33 lines
596 B
YAML
33 lines
596 B
YAML
|
|
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)
|