Introduction

this is part 32 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.


lab

in last part we create a pod . we are going to delete this pod using delete-pod

kubectl delete first-pod

As we see the pod got deleted , now I am going to use another random container from docker hub , I found an container called simple-api you can take a look at it here

let's create a pod from it create

kubectl run first-pod --image=emondek/simple-api:latest --restart=Never

let's take a look get-pods

kubectl get pods

we can see status creating container , if we need more info about it we type describe

kubectl describe pods/first-pod

if we scroll down we can see events events it's now on image pulling phase

after pulling we can see now that status is RUNNING done

now to run this pod in browser we need services(will talk about them later) but we have a nice hack to run it for now

forward

kubectl port-forward pods/first-pod 8080 

8080 is the port the we decide to use in dockerfile 8080

if we go to the browser and type http://localhost:8080/

we have our pod running

running

we can also access this pod using access

kubectl exec -it first-pod -- bash

We use -- to separate the commands that related to kubectl and linux. And every change we make to this pod will be discarded just like container so also we need volumes here :D

This post is also available on DEV.