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, 2019 in GCP by anonymous
• 6,260 points
1,712 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, 2019 by Sirajul
• 59,170 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, 2019 in GCP by Sirajul
• 59,170 points
998 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, 2019 in GCP by Sirajul
• 59,170 points
290 views
+1 vote
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, 2019 in GCP by Sirajul
• 59,170 points
621 views
0 votes
1 answer
0 votes
1 answer

How can I use a pre-existing disk as a persistent volume for a GKE cluster?

If you already have a persistent disk (say ...READ MORE

answered Nov 12, 2019 in GCP by Sirajul
• 59,170 points
1,905 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP