1. PV와 PVC는 앞에서 이미 생성했으므로 바로 스테이트풀셋을 다음 명령으로 생성합니다.
[root@m-k8s ~]# kubectl apply -f ~/_Book_k8sInfra/ch3/3.4.4/nfs-pvc-sts.yaml
statefulset.apps/nfs-pvc-sts created
7번째 줄에 serviceName이 추가된 것 외에는 앞의 nfs-pvc-deploy.yaml 코드와 동일합니다.
nfs-pvc-sts.yaml
-
apiVersion: apps/v1
-
kind: StatefulSet
-
metadata:
-
name: nfs-pvc-sts
-
spec:
-
replicas: 4
-
serviceName: sts-svc-domain #statefulset need it
-
selector:
-
matchLabels:
-
app: nfs-pvc-sts
-
template:
-
metadata:
-
labels:
-
app: nfs-pvc-sts
-
spec:
-
containers:
-
- name: audit-trail
-
image: sysnet4admin/audit-trail
-
volumeMounts:
-
- name: nfs-vol
-
mountPath: /audit
-
volumes:
-
- name: nfs-vol
-
persistentVolumeClaim:
-
claimName: nfs-pvc