Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon
Labs

Creating a ClusterRole to Access a PV in Kubernetes

In this hands-on lab, you will be tasked with accessing a persistent volume from a pod in order to view the available volumes inside the Kubernetes cluster. By default, pods cannot access volumes directly, so you will also need to create a cluster role to provide authorization to the pod. Additionally, you cannot access the API server directly without authentication, so you will need to run kubectl in proxy mode to retrieve information about the volumes.

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 1h 0m
Published
Clock icon Mar 31, 2019

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    View the Persistent Volume

    1. Use one command that will list the persistent volumes within the cluster.
  2. Challenge

    Create a ClusterRole and ClusterRoleBinding

    1. Use one command that will create a new ClusterRole with the verb get and list to the resource persistentvolumes.
    2. Use one command that will create a new ClusterRoleBinding to the ClusterRole, in the web namespace and using the default service account.
  3. Challenge

    Create a pod to access the PV

    1. Create the YAML file including the two containers, using the two images curlimages/curl and linuxacademycontent/kubectl-proxy.
    2. Issue a command to the curl container to sleep for 1 hour (3600 seconds).
    3. Apply the YAML to the Kubernetes cluster to run the pod.
  4. Challenge

    Request access to the PV from the pod

    1. Open a shell inside the container.
    2. From the container shell prompt, issue the curl command to request persistent volumes from the API server.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans