> For the complete documentation index, see [llms.txt](https://jeffgthompsons-organization.gitbook.io/yellow-team/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jeffgthompsons-organization.gitbook.io/yellow-team/training/cloud-guru/introduction-to-kubernetes/working-with-kubernetes-using-kubectl.md).

# Working with Kubernetes Using kubectl

## Use kubectl to Check the Status of Worker Nodes in the Cluster

* Use `kubectl` to list all nodes in the cluster
* Verify the nodes are in the READY state

## Get a List of Pods Running in the Cluster

* Use `kubectl` to list Pods in all namespaces
* Verify whether or not these Pods are all up and running

```
kubectl get pods --all-namespaces
```

<figure><img src="https://2666479439-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBLYaaERPa1yy1Qa8E1NQ%2Fuploads%2FOwkEdVGJ2qp2E9mMzdLc%2Fimage.png?alt=media&amp;token=ed83375e-4749-4de0-a430-7e4fe2bb4ab8" alt=""><figcaption></figcaption></figure>

## Delete an Existing Pod

* Delete the Pod named `web-frontend`

```
kubectl delete pod web-frontend
kubectl get pods --all-namespaces
```

<figure><img src="https://2666479439-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBLYaaERPa1yy1Qa8E1NQ%2Fuploads%2Fj5myaW0BzJOzZABxhQu0%2Fimage.png?alt=media&amp;token=7a578555-5eb1-4b13-93f7-759ecf25a905" alt=""><figcaption></figcaption></figure>

## Create a New Pod

* Create a new Pod called `web-frontend`
* Make it run a container with the `nginx` image

```
vi web-frontend.yml
```

**web-frontend.yml**

```
apiVersion: v1
kind: Pod
metadata:
    name: web-frontend
spec:
    containers:
    - name: nginx
      image: nginx    
```

```
kubectl create -f web-frontend.yml
kubectl get pods --all-namespaces
```

<figure><img src="https://2666479439-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBLYaaERPa1yy1Qa8E1NQ%2Fuploads%2FP65QyAE9WC0aAvemMNCq%2Fimage.png?alt=media&amp;token=856f0cd0-431a-4f0c-ae9a-87f434f9c3f2" alt=""><figcaption></figcaption></figure>
