makeporngreatagain.pro
yeahporn.top
hd xxx

Working with PV & PVC in Kubernetes

558
  1. Using Google Cloud, create a persistent disk in the same region as your cluster:
    gcloud compute disks create --size=1GiB --zone=us-central1-a mongodb

     

  2. The YAML for a pod that will use persistent disk:
    apiVersion: v1
    kind: Pod
    metadata:
      name: mongodb 
    spec:
      volumes:
      - name: mongodb-data
        gcePersistentDisk:
          pdName: mongodb
          fsType: ext4
      containers:
      - image: mongo
        name: mongodb
        volumeMounts:
        - name: mongodb-data
          mountPath: /data/db
        ports:
        - containerPort: 27017
          protocol: TCP

     

  3. Create the pod with disk attached and mounted:
    kubectl apply -f mongodb-pod.yaml

     

  4. See which node the pod landed on:
    kubectl get pods -o wide

     

  5. Connect to the mongodb shell:
    kubectl exec -it mongodb mongo

     

  6. Switch to the mystore database in the mongodb shell:
    use mystore

     

  7. Create a JSON document to insert into the database:
    db.foo.insert({name:'foo'})

     

  8. View the document you just created:
    db.foo.find()

     

  9. Exit from the mongodb shell:
    exit 

     

  10. Delete the pod:
    kubectl delete pod mongodb

     

  11. Create a new pod with the same attached disk:
    kubectl apply -f mongodb-pod.yaml

     

  12. Check to see which node the pod landed on:
    kubectl get pods -o wide

     

  13. Drain the node (if the pod is on the same node as before):
    kubectl drain [node_name] --ignore-daemonsets

     

  14. Once the pod is on a different node, access the mongodb shell again:
    kubectl exec -it mongodb mongo

     

  15. Access the mystore database again:
    use mystore

     

  16. Find the document you created from before:
    db.foo.find()

     

  17. The YAML for a PersistentVolume object in Kubernetes:
    apiVersion: v1
    kind: PersistentVolume
    metadata:
      name: mongodb-pv
    spec:
      capacity: 
        storage: 1Gi
      accessModes:
        - ReadWriteOnce
        - ReadOnlyMany
      persistentVolumeReclaimPolicy: Retain
      gcePersistentDisk:
        pdName: mongodb
        fsType: ext4

     

  18. Create the Persistent Volume resource:
    kubectl apply -f mongodb-persistentvolume.yaml

     

  19. View our Persistent Volumes:
    kubectl get persistentvolumes

Comments are closed, but trackbacks and pingbacks are open.

baseofporn.com https://www.opoptube.com
Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.