# Certified Kubernetes Administrator (CKA) Practice Exam: Part 3

\
**Create a Service Account. Create a service account in the `web` namespace called `webautomation`.**

**Linux**

<pre><code><strong>kubectl config use-context acgk8s
</strong>kubectl create sa webautomation -n web
</code></pre>

**Create a ClusterRole That Provides Read Access to Pods. Create a ClusterRole called `pod-reader` that has `get`, `watch`, and `list` access to all Pods.**

**Linux**

```
vi pod-reader.yml
```

**pod-reader.yml**

```
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
   name: pod-reader
rules:
- apiGroups: [""]
  resources: ["pods"]
  verbs: ["get", "watch", "list"]   
```

**Linux**

<pre><code><strong>kubectl create -f pod-reader.yml
</strong></code></pre>

**Bind the ClusterRole to the Service Account to Only Read Pods in the web Namespace. Bind the ClusterRole to the `webautomation` service account so that it can read all Pods, but only in the `web` namespace.**

**Linux**

```
vi rb-pod-reader.yml
```

**rb-pod-reader.yml**

```
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
   name: rb-pod-reader
   namespace: web
subjects:
- kind: ServiceAccount
  name: webautomation    
roleRef:
   kind: ClusterRole
   name: pod-reader
   apiGroup: rbac.authorization.k8s.io   
```

**Linux**

<pre><code><strong>kubectl create -f rb-pod-reader.yml
</strong><strong>kubectl get pods -n web --as=system:serviceaccount:web:webautomation
</strong></code></pre>

There are no pods in this namespace but if there was we'd be able to view them as the webautomation service account.

<figure><img src="/files/zIDqazfqlIJuqrvrhqBS" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jeffgthompsons-organization.gitbook.io/yellow-team/training/cloud-guru/certified-kubernetes-administrator-cka/certified-kubernetes-administrator-cka-practice-exam-part-3.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
