Imperatively working with your cluster. Run will "generate" a Deployment by default. This is pulling a specified image from Google's container registry. kubectl run, will convert a pod creation into a "Deployment generation" http://kubernetes.io/docs/user-guide/kubectl-conventions/#generators

kubectl run hello-world --image=gcr.io/google-samples/hello-app:1.0

But let's deploy a single pod too

kubectl run hello-world-pod --image=gcr.io/google-samples/hello-app:1.0 --generator=run-pod/v1

Expose the Deployment as a Serivce.

This will create a Service for the ReplicaSet behind the Deployment We are exposing our serivce on port 80, connecting to an application running on 8080 in our pod. Port: Interal Cluster Port, the Service's port. You will point cluster resources here. TargetPort: The Pod's Serivce Port, your application. That one we defined when we started the pods.

kubectl expose deployment hello-world --port=80 --target-port=8080 --nodePort=30001

export resources Exported resources are stripped of cluster-specific information.

kubectl get deployment hello-world -o yaml --export > deployment-hello-world.yaml

update our configuration with apply

kubectl apply -f deployment-hello-world.yaml