Introduction
this is part 33 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 lecture we use the Imperative method , now we need to use the declarative method.
yaml is really important for devops we use it in docker but we did not understand what it is or how it's really work , so it will be good also to cover it somewhere in this journey.
this is the yml file for a pod , it's on my github account you can access it on this link or if you follow me on docker parts so you already have DevOps folder just pull it.
let's back to the the file and break it to parts :
- apiVersion: Defines what version is used to create the Kubernetes Object.
- kind: Defines what object needs to be created in our example it's a single pod. We have name of first-api-dec if you remember in last part we call it first-api.
- metadata: You can add data here that helps uniquely identify objects in the Kubernetes cluster like name, type, etc.
- spec: This is the most important where you describe the description of the characteristics you want the resource to have, its desired state, etc.
kubectl get pods
this is the old pod is have an error I can fix it but no need to it in this part so why bother :p
we need to create our new pod from this yml file
kubectl create -f ./app_033.yml
because I am in same folder as file I can access it using ./app_033.yml so if you are in DevOpsJourney folder you should write ./app_033/app_033.yml
kubectl get pods
we can see we have our new pod is running and we see it take the name that we give it first-api-dec in the yml file.
Top comments (6)
Hello Omar, Your Docs are really good. Thanks for writing. I just wanted to view your DockerFile but couldn't view it, It says 404 not found in docker HUB.
Hello I am glad that you like them , can you share what link you use to access it?
hub.docker.com/r/emondek/simple-api
it's work fine for me not sure why didn't work for you , this is a picture for Dockerfile .
I will make sure to replace it with my own , I just pick a random Online one because I was busy,
BTW you can use any other image you want , just search in dockerhub for simple-api Or use any image you want , I use specifically this image because it contain a port and to open in browser.
Thanks btw. Just wanted to know if any external packages are installed during this pull from docker hub. Thanks for your time. 👍🏻
github.com/emondek/simple-api
Also I pick this because the files are available on github , you can read how the api is written also Dockerfile