two ways to create resources
1.cmd
kubectl run nginx-deployment --image=nginx:1.7.9 --replicas=2
2.configuration file :yml
kubectl apply -f nginx.yml
the advantage of yml:
1.describes What the app acheives final status
2.provides template for creating resources which can be deployed repeatly
3.deployment can be manged the same as the code mangement
4.suitable formal、cross-environment、scale deployment
5.difficult to be familar with grammar of yml
the configuration format of Deployment YAML
1.apiVersion is the version of current configuration format
2.kind is the type of created resource,now is Deployment
3.metadata is the Metadata of the resource ,the name is the required item.
4.spec is the size info of Deployment
5.replicas is the number of copy,by default is 1
6.tempate defines the template of Pod,which is important of YAML
7.metadata is the Metadata of the resource,at least one label
8.spec describes the size of Pod which defines the property of each container in Pod,the name and image is a must.