DEV Community

Cover image for #031 Kubernetes - Pods lab 1
Omar
Omar

Posted on

#031 Kubernetes - Pods lab 1

Introduction

this is part 31 from the journey it's a long journey(360 day) so go please check previous parts , and if you need to walk in the journey with me please make sure to follow because I may post more than once in 1 Day but surely I will post daily at least one 😍.

And I will cover lot of tools as we move on.


Pods

Today we are going to create a POD, We talk in the Introduction of Kubernetes little about Pods , creating pods is divided in 2 types :

  1. Imperative : it's mean we write what we need in commands style like args.
  2. Declarative : it's mean we write what we need in a file and we pass the file as arg. This one is better because it's IAC(instructions as code) so if the pod got corrupted we have all in a configuration file.

We have other commands related to it like delete,etc...


Lab

Let's travel back to docker if you remember in the journey we build an image and push it in part 012 . We are going to use for now.
link
run

kubectl run first-pod --image=omarelkhatib/app_009_1:latest --restart=Never
Enter fullscreen mode Exit fullscreen mode
  1. we run it using run (obviously)
  2. first-pod is the name of the pod
  3. --image is the profile/name:tag of the docker image (He know that he should get it from docker hub)
  4. --restart=Never , this we are going to talk about later :)

now to see the pods type

get

kubectl get pods
Enter fullscreen mode Exit fullscreen mode

Tip

if you are getting an tcp connection error just run minikube

minikube start --driver=virtualbox
Enter fullscreen mode Exit fullscreen mode

this will run minikube and setup Kubernetes to use it.

Top comments (0)