k8s部署StatefulSet案例yaml编排文件
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: push-testselinuxcn
namespace: rectest
labels:
service: push-testselinuxcn
spec:
replicas: 2
serviceName: push-testselinuxcn
selector:
matchLabels:
service: push-testselinuxcn
template:
metadata:
labels:
service: push-testselinuxcn
spec:
containers:
- name: push-testselinuxcn
image: hub.selinux.cn/test/push-testselinuxcn:myversion
resources:
limits:
cpu: 8
memory: 8Gi
requests:
cpu: 4
memory: 4Gi
imagePullPolicy: IfNotPresent
ports:
- containerPort: 33010
livenessProbe:
httpGet:
path: /test/health
port: 33010
initialDelaySeconds: 20
periodSeconds: 5
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /test/health
port: 33010
initialDelaySeconds: 20
periodSeconds: 5
timeoutSeconds: 5
nodeSelector:
type2: "true"
---
apiVersion: v1
kind: Service
metadata:
name: push-testselinuxcn
namespace: rectest
spec:
type: NodePort
ports:
- port: 33010
protocol: TCP
nodePort: 33051
selector:
service: push-testselinuxcn








