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 ./app033.yml so if you are in DevOpsJourney folder you should write ./app033/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.