Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info
iconfalse
Code Block
linenumberstrue
sansae@sansaeAir15m2 k8s-lab-workspace % k get pv
No resources found
sansae@sansaeAir15m2 k8s-lab-workspace % k get pvc
No resources found in default namespace.

sansae@sansaeAir15m2 k8s-lab-workspace % k apply -f pvc.yaml 
persistentvolumeclaim/foo-pvc created
sansae@sansaeAir15m2 k8s-lab-workspace % k get pvc
NAME      STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
foo-pvc   Bound    pvc-735e1382-f1e1-40f3-8378-25e72ebda4b0   1Gi        RWO            azurefile      3s
sansae@sansaeAir15m2 k8s-lab-workspace % k get pv
NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM             STORAGECLASS   REASON   AGE
pvc-735e1382-f1e1-40f3-8378-25e72ebda4b0   1Gi        RWO            Delete           Bound    default/foo-pvc   azurefile               5s
sansae@sansaeAir15m2 k8s-lab-workspace % 

Code Block
titlestatefulset.yaml
linenumberstrue
collapsetrue
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: web
spec:
  selector:
    matchLabels:
      app: nginx
  serviceName: "nginx"
  replicas: 3 # 기본값은 1
  minReadySeconds: 10 # 기본값은 0
  template:
    metadata:
      labels:
        app: nginx
    spec:
      terminationGracePeriodSeconds: 10
      containers:
      - name: nginx
        image: nginx:1.15.12
        ports:
        - containerPort: 80
          name: web
        volumeMounts:
        - name: www
          mountPath: /usr/share/nginx/html
  volumeClaimTemplates:
  - metadata:
      name: www
    spec:
      accessModes: [ "ReadWriteOnce" ]
      storageClassName: azurefile
      resources:
        requests:
          storage: 1Gi
Code Block
titlestatefulset.yaml 실습
linenumberstrue
collapsetrue
sansae@sansaeAir15m2 k8s-lab-workspace % k apply -f statefulset.yaml 
service/nginx-stps created
statefulset.apps/web created

sansae@sansaeAir15m2 k8s-lab-workspace % k get pvc
NAME        STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
www-web-0   Bound    pvc-d7a6b825-edeb-4f06-813f-eef6abe19398   1Gi        RWO            azurefile      52s
www-web-1   Bound    pvc-a2ebaeef-ae82-47bc-8988-6bb6ca0a9067   1Gi        RWO            azurefile      32s
www-web-2   Bound    pvc-e17e5080-4403-4131-9d2b-f143431681df   1Gi        RWO            azurefile      12s

sansae@sansaeAir15m2 k8s-lab-workspace % k get pv
NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM               STORAGECLASS   REASON   AGE
pvc-a2ebaeef-ae82-47bc-8988-6bb6ca0a9067   1Gi        RWO            Delete           Bound    default/www-web-1   azurefile               55s
pvc-d7a6b825-edeb-4f06-813f-eef6abe19398   1Gi        RWO            Delete           Bound    default/www-web-0   azurefile               74s
pvc-e17e5080-4403-4131-9d2b-f143431681df   1Gi        RWO            Delete           Bound    default/www-web-2   azurefile               34s