# Deploying our first app in the K8s pod

In this blog, we will explore more deeply about Kubernetes. In the previous blogs, we discussed the Kubernetes architecture and management tools like kOps as the fundamentals of Kubernetes. In this blog, we will know about the Pod and deploy our application in the pod.

### What is Pod?

A pod is similar to the container but the container is created using the Docker CLI commands while a Pod is created by writing the manifest in the YAML file. Therefore, to create a pod we should know YAML.

In a single pod, single or multiple containers can be created. By the way, in Kubernetes, everything is dealt with YAML file whether it is about creating pods, service, deployment, etc.

If we create multiple containers inside the pod, then Kubernetes provides shared networking and shared storage. In this way, the containers inside the pod can communicate with each other using the local host.

**Setup**

Kubectl - command line tool

Minikube - local development environment, single node architecture

* To install Kubectl
    

```plaintext
sudo apt install kubectl -y
```

* TO install minikube
    

```plaintext
sudo apt-get install -y minikube
```

* To start minikube
    

```plaintext
minikube start
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1704794115981/43ca43b9-58a8-4d7e-8dd7-0f0ea59b0962.png align="center")

Our minikube is running and lets run some commands

* To get node information
    

```plaintext
kubectl get nodes
```

* To get Pods information
    

```plaintext
kubectl get pods
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1704794290445/565346fb-1eb5-4d7a-8f34-d19ec242b8af.png align="center")

* Let's write our first pod.yml file
    

```yaml
apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
  - name: nginx
    image: nginx:1.14.2
    ports:
    - containerPort: 80
```

Here, this YAML code describes a Kubernetes Pod named "nginx" that runs a single container using the NGINX image version 1.14.2. The container exposes port 80, allowing traffic to access the NGINX web server within the Pod. This Pod definition is a basic configuration used for deploying a simple NGINX web server in a Kubernetes cluster.

* To run the pod
    

```yaml
kubectl apply -f pod.yml
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1704795311096/c5323bd6-c523-4f41-ad3e-214a75a374f7.png align="center")

Our pod is created successfully.

* To get more details about the pod
    

```yaml
kubectl get po pod_name -o wide
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1704795478856/f346407b-2314-4475-b708-06ae9b42d7ea.png align="center")

* To enter into the container
    

```bash
minikube ssh
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1704795697700/24b2287b-e56e-46aa-bd3f-5aeb3208f868.png align="center")

We do not need to enter the IP address to log into the container.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1704795847187/526fd22e-e6bf-46e6-94db-0801fb8065d2.png align="center")

We can see our first ever Kubernetes application is created and is running perfectly.

* To inspect the pod
    

```bash
kubectl describe pods pod-name
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1704796594980/f392bd39-f260-4db1-a192-cd3b9bbbe9fb.png align="center")

* To get logs of the pod for any issue
    

```bash
kubectl logs pod_name
```

In this way, we can debug and view the logs of the Kubernetes pods. Pods are simple and easy to use. To enhance with features like autoscaling, and auto-healing, we will use the services and deployments in the upcoming blogs.

Happy Learning!!
