With our stateful-set.yaml ready, it's time to deploy our Service and StatefulSet onto our remote cloud cluster.
At the moment, our remote cluster is not running anything apart from the Kubernetes Master Components:
$ kubectl get all
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.32.0.1 <none> 443/TCP 17h
The Kubernetes Master Components are automatically deployed when we create a new cluster using DigitalOcean.
To deploy our Service and StatefulSet, we will use kubectl apply:
$ kubectl apply -f manifests/elasticsearch/service.yaml
service "elasticsearch" created
$ kubectl apply -f manifests/elasticsearch/stateful-set.yaml
statefulset.apps "elasticsearch" created
Give it a minute or so, and run kubectl get all again. You should see that the Pods, StatefulSet, and our headless Service are running successfully!
$ kubectl get all
NAME READY STATUS RESTARTS AGE
pod/elasticsearch-0 1/1 Running 0 1m
pod/elasticsearch-1 1/1 Running 0 1m
pod/elasticsearch-2 1/1 Running 0 10s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/elasticsearch ClusterIP None <none> 9200/TCP,9300/TCP 1m
service/kubernetes ClusterIP 10.32.0.1 <none> 443/TCP 18h
NAME DESIRED CURRENT AGE
statefulset.apps/elasticsearch 3 3 1m