Running Pods with kubectl run

First, confirm that no Elasticsearch containers are currently running on our machine:

$ docker ps -a \ --filter "name=elasticsearch" \ --format "table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.Names}}"CONTAINER ID IMAGE COMMAND NAMES

We can now use kubectl run to run an image inside a Pod, and deploy it onto our cluster:

$ kubectl run elasticsearch --image=docker.elastic.co/elasticsearch/elasticsearch-oss:6.3.2 --port=9200 --port=9300deployment.apps "elasticsearch" created

Now, when we check the Pods that have been deployed onto our cluster, we can see a new elasticsearch-656d7c98c6-s6v58 Pod:

$ kubectl get podsNAME READY STATUS RESTARTS AGEelasticsearch-656d7c98c6-s6v58 0/1 ContainerCreating 0 9s

It may take some ...

Get Building Enterprise JavaScript Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.