Ubuntu 20.04
Sponsored Link

MicroK8s : Fluentd を有効にする2020/08/17

 
Fluentd アドオンを有効にして、MicroK8s クラスターで Elasticsearch, Fluentd, Kibana (EFK Stack) を構成します。
[1] プライマリーノードで、Fluentd アドオンを有効にします。
root@dlp:~#
microk8s enable fluentd dns

Enabling DNS
Applying manifest
serviceaccount/coredns created
configmap/coredns created
deployment.apps/coredns created
service/kube-dns created
clusterrole.rbac.authorization.k8s.io/coredns created
clusterrolebinding.rbac.authorization.k8s.io/coredns created
Restarting kubelet
DNS is enabled
Enabling Fluentd-Elasticsearch
Labeling nodes
node/dlp.srv.world labeled
Addon dns is already enabled.
service/elasticsearch-logging created
serviceaccount/elasticsearch-logging created
clusterrole.rbac.authorization.k8s.io/elasticsearch-logging created
clusterrolebinding.rbac.authorization.k8s.io/elasticsearch-logging created
statefulset.apps/elasticsearch-logging created
configmap/fluentd-es-config-v0.1.5 created
serviceaccount/fluentd-es created
clusterrole.rbac.authorization.k8s.io/fluentd-es created
clusterrolebinding.rbac.authorization.k8s.io/fluentd-es created
daemonset.apps/fluentd-es-v2.2.0 created
deployment.apps/kibana-logging created
service/kibana-logging created
Fluentd-Elasticsearch is enabled

root@dlp:~#
microk8s kubectl get services -n kube-system

NAME                    TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                  AGE
elasticsearch-logging   ClusterIP   10.152.183.169   <none>        9200/TCP                 3m14s
kibana-logging          ClusterIP   10.152.183.218   <none>        5601/TCP                 3m14s
kube-dns                ClusterIP   10.152.183.10    <none>        53/UDP,53/TCP,9153/TCP   3m31s

root@dlp:~#
microk8s kubectl get pods -A

NAMESPACE     NAME                              READY   STATUS    RESTARTS   AGE
kube-system   coredns-588fd544bf-cpp79          1/1     Running   0          94s
kube-system   elasticsearch-logging-0           1/1     Running   0          77s
kube-system   fluentd-es-v2.2.0-tljxj           1/1     Running   0          77s
kube-system   kibana-logging-84f486f46b-th5sj   1/1     Running   0          77s

root@dlp:~#
microk8s kubectl cluster-info

Kubernetes master is running at https://127.0.0.1:16443
Elasticsearch is running at https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/elasticsearch-logging/proxy
Kibana is running at https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/kibana-logging/proxy
CoreDNS is running at https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
Metrics-server is running at https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/https:metrics-server:/proxy

# kube proxy を起動

# 必要に応じてアクセス許可範囲は変更

root@dlp:~#
microk8s kubectl proxy --address=0.0.0.0 --accept-hosts=.*

Starting to serve on [::]:8001
[2] ローカルネットワーク内の任意のクライアントコンピューターで Web ブラウザーを起動し、 [http://(MicroK8s プライマリーノードのホスト名 または IP アドレス):8001/api/v1/namespaces/kube-system/services/kibana-logging/proxy] にアクセスして、Kibana のダッシュボードが表示されれば OK です。
関連コンテンツ