How to use this persistent volume claim with my GKE cluster?

0 votes

I have created a persistent volume and persistent volume claim as specified in https://www.edureka.co/community/59670/can-use-pre-existing-disk-persistent-volume-for-gke-cluster How to use it on my cluster?

Nov 12 in GCP by anonymous
• 4,330 points
28 views

1 answer to this question.

0 votes

After the PersistentVolume and PersistentVolumeClaim exist in the cluster, you can give a Pod's containers access to the volume by specifying values for the container's volumeMounts.mountPath and volumeMounts.name, as shown in the following example:

kind: Pod
apiVersion: v1
metadata:
  name: task-pv-pod
spec:
  volumes:
    - name: task-pv-storage
      persistentVolumeClaim:
       claimName: pv-claim-demo
  containers:
    - name: task-pv-container
      image: nginx
      ports:
        - containerPort: 80
          name: "http-server"
      volumeMounts:
        - mountPath: "/usr/share/nginx/html"
          name: task-pv-storage

When you apply this manifest to a cluster, the Pod is created, and the task-pv-container container has access to the volume in its /usr/share/nginx/html/ directory.

answered Nov 12 by Sirajul
• 40,980 points

Related Questions In GCP

0 votes
1 answer

How to disable the Kubernetes Dashboard for a GKE cluster?

The Kubernetes Dashboard is disabled by default on ...READ MORE

answered Oct 30 in GCP by Sirajul
• 40,980 points
31 views
0 votes
1 answer

How to verify that my cluster is using routes?

List your cluster nodes: kubectl get nodes The output ...READ MORE

answered Oct 31 in GCP by Sirajul
• 40,980 points
39 views
0 votes
1 answer
0 votes
1 answer

Can I create a load balancer with path based routing in GKE?

Yes, it's possible. Note that you simply will use the internal Load balancing (ILB) for ...READ MORE

answered Oct 10 in GCP by Sirajul
• 40,980 points
43 views
0 votes
1 answer