You are on page 1of 10

4/26/23, 3:25 PM Kubernetes Pods & Deploy Your First App

TABLE OF CONTENTS

DeployToCloud
Follow

Kubernetes Pods & Deploy Your First App


Suman Prasad
Apr 24, 2023 · 4 min read

10
PLAY THIS ARTICLE
https://sumanprasad.hashnode.dev/kubernetes-pods-deploy-your-first-app 1/10
4/26/23, 3:25 PM Kubernetes Pods & Deploy Your First App

TABLE OF CONTENTS
0:00 / 3:55

📍 Introduction:
In this blog, you will learn about Kubernetes pods, which are the smallest
deployable units in Kubernetes. You will learn the differences between containers
and pods, how to install kubectl and Minikube, and how to create and write your
first Pod. Additionally, you will discover the advantages of using Pods in
Kubernetes.

🔹 Container vs Pod:
Containers are standalone executable packages of software that include
everything needed to run an application, including code, libraries, and system
https://sumanprasad.hashnode.dev/kubernetes-pods-deploy-your-first-app 2/10
4/26/23, 3:25 PM Kubernetes Pods & Deploy Your First App

tools. A Pod is the smallest deployable unit in Kubernetes, and it is a logical host
TABLE
for one OF CONTENTS
or more containers. A Pod can contain one or more containers, and those
containers share the same network namespace, and they can also share the same
storage volumes.

🔹 What is Kubectl && Installation:


Kubectl is a command-line tool for Kubernetes that allows you to deploy and
manage applications on a Kubernetes cluster. You can install Kubectl on your local
machine by following the instructions on the Kubernetes documentation. Here is an
example of how to install Kubectl on Ubuntu:
COPY

$ sudo apt-get update && sudo apt-get install -y apt-transport-https gnupg2


$ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key
$ echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc
$ sudo apt-get update
$ sudo apt-get install -y kubectl

🔹 Minikube Installation:
Minikube is a tool that allows you to run a Kubernetes cluster on your local
machine. You can install Minikube by following the instructions on the Kubernetes
documentation. Here is an example of how to install Minikube on Ubuntu:
COPY

https://sumanprasad.hashnode.dev/kubernetes-pods-deploy-your-first-app 3/10
4/26/23, 3:25 PM Kubernetes Pods & Deploy Your First App

TABLE OF CONTENTS
$ curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-li
$ sudo install minikube-linux-amd64 /usr/local/bin/minikube

🔹 How to create a Pod:


You can create a Pod using the kubectl create command. Here is an example of
how to create a Pod:
COPY

$ kubectl create pod nginx --image=nginx

🔹 How to write your first Pod:


You can write your first Pod using a YAML file. Here is an example of a YAML file
that defines a Pod with a single container:
COPY

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

https://sumanprasad.hashnode.dev/kubernetes-pods-deploy-your-first-app 4/10
4/26/23, 3:25 PM Kubernetes Pods & Deploy Your First App

You can create the Pod using the kubectl apply command:
TABLE OF CONTENTS
COPY

$ kubectl apply -f pod.yaml

📍 Advantages of Pods: Pods provide several


advantages, including:
Simplified networking: Containers within a Pod can communicate over
localhost, which eliminates the need for complex networking configurations
and enables easy service discovery and load balancing.
Shared resources: Pods can share storage volumes, environment variables,
and secrets, which enables data sharing and coordination between containers.
Atomic scheduling: Pods are the smallest unit of deployment in Kubernetes
and can be scheduled and replicated atomically, which ensures high
availability and fault tolerance.
Sidecar containers: Pods can include sidecar containers that provide additional
functionality, such as logging, monitoring, or networking, which enhances the
capabilities and resilience of the application.
Blue-green deployment: Pods can be used for blue-green or canary
deployments, where a new version of the application is deployed to a new set
of Pods and then gradually phased in, while the old version is phased out,
which reduces the risk and downtime of the deployment.
Scaling: Pods can be scaled horizontally or vertically by adding or removing
replicas or adjusting the resource limits of the containers, which enables
efficient resource utilization and responsiveness.

https://sumanprasad.hashnode.dev/kubernetes-pods-deploy-your-first-app 5/10
4/26/23, 3:25 PM Kubernetes Pods & Deploy Your First App

They provide a logical host for one or more containers, which allows you to
TABLErelated
group OF CONTENTS
containers together and manage them as a single unit.
They share the same network namespace, which allows containers within a
Pod to communicate with each other using localhost .
They can share the same storage volumes, which allows containers within a
Pod to share data.
They can be easily scaled horizontally by creating multiple replicas of the same
Pod.
📍 Conclusion:
Kubernetes Pods provide a powerful abstraction for deploying and managing
containerized applications in a scalable, flexible, and resilient way. By using Pods,
you can simplify networking, share resources, ensure atomic scheduling, enable
co-located and sidecar containers, support blue-green deployment, and achieve
efficient scaling. With the knowledge and skills gained from this tutorial, you can
start building and running your own Kubernetes Pods and take your container
orchestration to the next level.
Join the community of learners and be a part of the conversation! Your feedback is valuable to us, so please
share your thoughts in the comments section. Help us make this blog even better for everyone. And if you
found this post helpful, spread the word! Share it with those who could benefit from the information. And
don't forget to follow along and subscribe to our newsletter for instant updates on our latest content. Thank
you for taking the time to read and engage with us!

https://sumanprasad.hashnode.dev/kubernetes-pods-deploy-your-first-app 6/10
4/26/23, 3:25 PM Kubernetes Pods & Deploy Your First App

Subscribe to my newsletter
TABLE OF CONTENTS
Read articles from DeployToCloud directly inside your inbox. Subscribe to the
newsletter, and don't miss out.
Enter your email address SUBSCRIBE

Did you find this article valuable?


Support Suman Prasad by becoming a sponsor.
Any amount is appreciated!
Sponsor
Learn more about Hashnode Sponsors

Beginner Developers Devops Developer AWS Linux

https://sumanprasad.hashnode.dev/kubernetes-pods-deploy-your-first-app 7/10
4/26/23, 3:25 PM Kubernetes Pods & Deploy Your First App

TABLE WRITTEN
OF CONTENTS
BY
Suman Prasad
Follow

I'm Proficient in a variety of DevOps technologies, including AWS, Linux, Python,


Shell Scripting, Docker, Terraform, Jenkins, Git/GitHub, and Computer
Networking. I have a strong ability to troubleshoot and resolve issues, and are
consistently motivated to expand the knowledge and skills through exploration
of new technologies.

MORE ARTICLES
Suman Prasad

Day 2 - Kubernetes Networking: Ingress, Network Policies,


DNS, CNI Plugins

https://sumanprasad.hashnode.dev/kubernetes-pods-deploy-your-first-app 8/10
4/26/23, 3:25 PM Kubernetes Pods & Deploy Your First App

📍 Introduction: Welcome to this blog post where we will be discussing various


TABLE OFconcepts
Kubernetes CONTENTS
a…
Suman Prasad

Day - 1: Kubernetes Architecture and Components,


Kubernetes Installation and Configuration
📍 Introduction: Welcome to TWS Kubernetes Challenge, where we believe in constant
learning and grow…

Suman Prasad

https://sumanprasad.hashnode.dev/kubernetes-pods-deploy-your-first-app 9/10
4/26/23, 3:25 PM Kubernetes Pods & Deploy Your First App

TABLE OF CONTENTS

From Challenge to Reward: Meetup with Shubham Londhe


Sir 😃 ©2023 DeployToCloud
I would like to express my gratitude
Archive ·toPrivacy
Shubham Sir for
policy · initiating the #90daysofDevOps
Terms
challenge. As…

Publish with Hashnode

Powered by Hashnode - Home for tech writers and readers

https://sumanprasad.hashnode.dev/kubernetes-pods-deploy-your-first-app 10/10

You might also like