kubernetes-simple yaml file for nginx deployment!
Behnam Hasanbeygi
Senior Machine learning Engineer at Dotin | Senior MLOps at AIFA | medical images | +8 years experience | bioinformatic resarcher | LLM-medical | open to help startups for build their ai teams | DAIDA association
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 kind: Deployment metadata: name: nginx-deployment spec: selector: matchLabels: app: nginx replicas: 2 # tells deployment to run 2 pods matching the template template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80
this is a sample for deployment concept!
apiVersion: its a api created by kubernetes for update in future and last version of api was v1
kind: in kubernetes all object is a kind like pod repicationcontroller,services,....
metadata:its a section that we can choice a name for our kind and we labels our kind!on this yaml example we have a deployment kind and on the section of spec we have labels
spec: selector and labels is like key and locking they just match together maybe we have so many pod or so many service they can know each other with label and selector
repilcaset:its a new version of replication controller and its mean how many pod we need to be run(if one of pod is fails soon replace by another pod)
template:its a pattern for run pod in this yaml file
containers:name of your container want to deploy
image:name of images in your or docker hub repository
ports:expose port 80 for your container in cluster