Running Elasticsearch {Stack} on
Kubernetes
@aravindputrevu
@aravindputrevu
Hello
Aravind Putrevu
Developer Advocate
aravind.dev | @aravindputrevu
@aravindputrevu
Key Takeaways
{on}
@aravindputrevu
Elastic Stack
@aravindputrevu
Elastic Stack
@aravindputrevu
Elastic Stack used by...
@aravindputrevu
Deploying Elastic Stack
@aravindputrevu
Btw, what is Kubernetes?
@aravindputrevu
Kubernetes resources in a nutshell
• Basically:
○ Run Pods (group of Docker Containers) on a fleet of Nodes
Node Node Node
Pod
container
container Pod
container
Pod
container
Pod
container
container
container
Pod
container
@aravindputrevu
Kubernetes resources in a nutshell
• Basically:
○ Run Pods (group of Docker Containers) on a fleet of Nodes
○ Access (TCP) your apps using Services (round-robin on healthy Pods)
Node Node Node
Pod
container
container Pod
container
Pod
container
Pod
container
container
container
Pod
container
Service Service
@aravindputrevu
Kubernetes resources in a nutshell
• Basically:
○ Run Pods (group of Docker Containers) on a fleet of Nodes
○ Access (TCP) your apps using Services (round-robin on healthy Pods)
○ Mount Volumes and Secrets into Pods
Node Node Node
Pod
container
Pod
container
Pod
container
Pod
container
container
Pod
container
Service Service
Volume
(local)
Secret
@aravindputrevu
Kubernetes resources in a nutshell
• Basically:
○ Run Pods (group of Docker Containers) on a fleet of Nodes
○ Access (TCP) your apps using Services (round-robin on healthy Pods)
○ Mount Volumes and Secrets into Pods
Node Node Node
Pod
container
container Pod
container
Pod
container
Pod
container
container
container
Pod
container
Service Service
Volume
(NAS)
Volume
(local)
Secret
@aravindputrevu
Kubernetes resources in a nutshell
• Many more resources exist:
○ Deployment: N replicas of the same Pod
○ DaemonSet: same Pod running on all Nodes
○ PersistentVolume: a Volume that can be reattached to different Pods
○ StatefulSet: N replicas of the same Pod, with PersistentVolumes
automatically reattached to a given Pod
○ etc.
@aravindputrevu
Kubernetes resources in a nutshell
• Resources are yaml (or json) objects with a well-defined schema
@aravindputrevu
Kubernetes architecture
etcd
apiserver
apiserver
apiserver
Node Node Node
kubelet kubelet kubelet
Controllers
Controllers
Controllers
controllers
user
@aravindputrevu
Kubernetes architecture
etcd
apiserver
apiserver
apiserver
Node Node Node
kubelet kubelet kubelet
Controllers
Controllers
Controllers
controllers
user
etcd
● Persistent distributed key-value
store, organized as a filesystem
● With a watch mechanism
● Stores all k8s resources
@aravindputrevu
Kubernetes architecture
etcd
apiserver
apiserver
apiserver
Node Node Node
kubelet kubelet kubelet
Controllers
Controllers
Controllers
controllers
user
apiserver
● API to create/update/delete k8s resources
● Handles authentication & authorization
● Horizontally scalable
● With a watch mechanism
@aravindputrevu
Kubernetes architecture
etcd
apiserver
apiserver
apiserver
Node Node Node
kubelet kubelet kubelet
Controllers
Controllers
Controllers
controllers
user
user
● Interacts with apiserver HTTP API
● Often with kubectl (CLI)
@aravindputrevu
Kubernetes architecture
etcd
apiserver
apiserver
apiserver
Node Node Node
kubelet kubelet kubelet
Controllers
Controllers
Controllers
controllers
user
kubelet
● Agent running on each Node
● Watches Pods in the apiserver
● Manages corresponding
containers on the host
@aravindputrevu
Kubernetes architecture
etcd
apiserver
apiserver
apiserver
Node Node Node
kubelet kubelet kubelet
Controllers
Controllers
Controllers
controllers
user
controllers
● Watch resources in the apiserver
● Process them with their own logic
○ May createanew resources on the
apiserver
○ May interact with external systems
@aravindputrevu
Kubernetes architecture
• Some existing controllers:
○ scheduler: watches Pods, assigns them to a Node
○ replication-controller: maintains the correct number of Pods as
defined in a ReplicaSet (-> Deployment)
○ endpoints-controller: joins Pods IP/port in Services
○ cloud-provider-X-controller: create eg. EBS volumes
○ etc.
@aravindputrevu
Deploying Applications in {k8s}
@aravindputrevu
Deploying Applications in {k8s}
2424
Package Manager for Kubernetes
github.com/elastic/helm-charts
2525
Deploying Applications in {k8s}
@aravindputrevu
Helm vs Operator
@aravindputrevu
Helm vs Operator
2828
github.com/elastic/cloud-on-k8s
@aravindputrevu
● Custom Resources Definitions (CRD)
○ Elasticsearch, Kibana, APM
● A set of controllers
● Automate Tasks
○ Generate TLS certificates
○ Create Secrets holding
configuration & certs
○ Create a Service to access the
cluster
○ Create ES users
○ Deployment Templates
Elastic Cloud on
Kubernetes
3030
@aravindputrevu
community.elastic.co
ela.st/eck-k8s
Thank you
Questions?
@aravindputrevu

Running Elasticsearch {Stack} on Kubernetes