kubernetes中安装efk
下载efk资源清单
for i in es-service.yaml es-statefulset.yaml fluentd-es-configmap.yaml fluentd-es-ds.yaml kibana-deployment.yaml kibana-service.yaml ;do wget https://raw.githubusercontent.com/kubernetes/kubernetes/master/cluster/addons/fluentd-elasticsearch/$i;done
修改Yaml清单
sed -i 's/k8s.gcr.io/mirrorgooglecontainers/g' es-statefulset.yaml sed -i 's/k8s.gcr.io/mirrorgooglecontainers/g' fluentd-es-ds.yaml sed -i -e 's@.*SERVER_BASEPATH.*@#&@g' -e 's@.*/api/v1/namespaces/kube-system/services/kibana-logging/proxy@#&@g' kibana-deployment.yaml sed -i 's/v6.2.5/v6.3.0/g' es-statefulset.yaml
持久存储日志
sed -i -e 's/emptyDir: {}/hostPath:/g' -e '/hostPath/a\ path: /es-logdata\n type: DirectoryOrCreate' es-statefulset.yaml
修改集群属性
kubectl label nodes --all beta.kubernetes.io/fluentd-ds-ready=true kubectl taint nodes --all node-role.kubernetes.io/master-
重新制作fluentd-elasticsearch镜像
for i in Dockerfile Gemfile Makefile README.md clean-apt clean-install fluent.conf run.sh;do wget https://raw.githubusercontent.com/kubernetes/kubernetes/master/cluster/addons/fluentd-elasticsearch/fluentd-es-image/$i;done chmod +x clean-apt clean-install run.sh docker build -t fluentd-elasticsearch:v2.2.0 .