K8S项目示例
apiVersion: apps/v1
kind: Deployment
metadata:
name: zgy-app
namespace: work
spec:
replicas: 1
selector:
matchLabels:
app: app-center
template:
metadata:
labels:
app: app-center
spec:
containers:
- name: app-center
image: 192.168.2.247/k8s-work/zgy-app
ports:
- containerPort: 7201
livenessProbe:
tcpSocket:
port: 7201
initialDelaySeconds: 10
periodSeconds: 15
readinessProbe:
tcpSocket:
port: 7201
initialDelaySeconds: 15
periodSeconds: 20
imagePullSecrets:
- name: harbor
---
apiVersion: v1
kind: Service
metadata:
name: app-center-service
namespace: work
spec:
selector:
app: app-center
ports:
- protocol: TCP
port: 7201
targetPort: 7201