Creating kubernetes services using YAML and JSON files
You can also create Kubernetes resources manually using YAML and JSON files. Let's go ahead and create a simple pod running ahttpdweb server using the kubectl create command. We will have to create a YAML-formatted file:
Reading YAML and JSON-formatted files is critical for Kubernetes and for later, in the OpenShift chapter. If you feel uncomfortable reading YAML or JSON files, read up on these subjects. Check the Further reading section for more information.
It may look a bit complicated and hard to understand, but as we move on in this book, you will see a lot of similarities between these YAML and JSON files.
$ kubectl get all NAME READY STATUS RESTARTS AGE po/httpd 1/1 Running 0 25s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE svc/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 56s
This command creates a pod named httpd; it does not create anything else. In larger deployments with heavy automation involved, this is the way to deploy Kubernetes resources, but this, of course, requires better Kubernetes skills.
Similarly, we can create other Kubernetes resources, including ReplicaSet, Deployment, and others.