# Pod Connectivity

### How to deploy pods?

Lets now take a look to create a nginx pod using **`kubectl`**.

Step 1: To deploy a docker container by creating a POD.

```
kubectl run myapp --image nginx
```

Step 2: To get the list of pods

```
kubectl get pods
```

Step 3: Run the command \*\*`kubectl describe pod <<podname>>`\*\*look under the containers section.

```
kubectl describe pod myapp
```

```
kubectl delete pod myapp
```

Step 4: Create a pod definition YAML file and use it to create a POD or use the command **`kubectl run myapp-pod --image=nginx`**.

```
kubectl run myapp-pod --image=nginx --dry-run=client -o yaml > myapp-pod.yaml
```

```
kubectl create -f myapp-pod.yaml
```

Step 5: View the Manifest and the file would like something like this or you can modify the file as below. Some not important structure is removed from the original file.

```yaml
apiVersion: v1
kind: Pod
metadata:
  labels:
    run: myapp
  name: myapp-pod
spec:
  containers:
  - image: nginx
    name: myapp-container
  restartPolicy: Always
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://nishanthkp.gitbook.io/devsecops-for-bbk/understand-k8s/pod.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.
