Setting up EFK with kops

kops also has an add-on for setting up the EFK stack on your Kubernetes cluster easily. Proceed through the following steps to run EFK stack on your Kubernetes:

  1. Run kubectl create to specify the kops EFK add-on:
$ kubectl create -f https://raw.githubusercontent.com/kubernetes/kops/master/addons/logging-elasticsearch/v1.6.0.yaml
serviceaccount "elasticsearch-logging" created
clusterrole "elasticsearch-logging" created
clusterrolebinding "elasticsearch-logging" created
serviceaccount "fluentd-es" created
clusterrole "fluentd-es" created
clusterrolebinding "fluentd-es" created
daemonset "fluentd-es" created
service "elasticsearch-logging" created
statefulset "elasticsearch-logging" created
deployment "kibana-logging" created
service "kibana-logging" created
  1. Wait for the STATUS of all Pods to become Running:
$ kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system dns-controller-dc46485d8-pql7r 1/1 Running 0 5m
kube-system elasticsearch-logging-0 1/1 Running 0 1m
kube-system elasticsearch-logging-1 1/1 Running 0 53s
kube-system etcd-server-events-ip-10-0-48-239.ec2.internal 1/1 Running 0 5m
kube-system etcd-server-ip-10-0-48-239.ec2.internal 1/1 Running 0 5m
kube-system fluentd-es-29xh9 1/1 Running 0 1m
kube-system fluentd-es-xfbd6 1/1 Running 0 1m
kube-system kibana-logging-649d7dcc87-mrtzc 1/1 Running 0 1m
kube-system kube-apiserver-ip-10-0-48-239.ec2.internal 1/1 Running 0 5m
...
  1. Check Kibana's log and wait until the state becomes green:
$ kubectl logs -f kibana-logging-649d7dcc87-mrtzc --namespace=kube-system
ELASTICSEARCH_URL=http://elasticsearch-logging:9200
server.basePath: /api/v1/proxy/namespaces/kube-system/services/kibana-logging
{"type":"log","@timestamp":"2018-03-26T01:02:04Z","tags":["info","optimize"],"pid":6,"message":"Optimizing and caching bundles for kibana and statusPage. This may take a few minutes"}

(wait for around 5min)

{"type":"log","@timestamp":"2018-03-26T01:08:00Z","tags":["status","plugin:[email protected]","info"],"pid":6,"state":"yellow","message":"Status changed from yellow to yellow - No existing Kibana index found","prevState":"yellow","prevMsg":"Waiting for Elasticsearch"}
{"type":"log","@timestamp":"2018-03-26T01:08:03Z","tags":["status","plugin:[email protected]","info"],"pid":6,"state":"green","message":"Status changed from yellow to green - Kibana index ready","prevState":"yellow","prevMsg":"No existing Kibana index found"}
  1. Run kubetl cluster-info to capture the Kibana URL:
$ kubectl cluster-info
Kubernetes master is running at https://api.chap9.k8s-devops.net
Elasticsearch is running at https://api.chap9.k8s-devops.net/api/v1/namespaces/kube-system/services/elasticsearch-logging/proxy
Kibana is running at https://api.chap9.k8s-devops.net/api/v1/namespaces/kube-system/services/kibana-logging/proxy
KubeDNS is running at https://api.chap9.k8s-devops.net/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
  1. Use kubectl proxy to forward your machine to the Kubernetes API server:
$ kubectl proxy --port=8080
Starting to serve on 127.0.0.1:8080
  1. Access the Kibana WebUI from your machine using the following URL: http://127.0.0.1:8080/api/v1/namespaces/kube-system/services/kibana-logging/proxy. Note that the IP address is 127.0.0.1, which is correct because we are using a kubectl proxy.

Now, you can start to use Kibana. Configure an index as described in the preceding minikube and kubespray sections.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.82.154