ChatingRoomProject/k8s-deployment.yaml

33 lines
596 B
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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