k8sConfigs/efk/init.sh
2025-03-24 19:12:41 +08:00

40 lines
1.6 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

cd /home/ubuntu/k8sCongfigs/traefik
microk8s.kubectl apply -f traefik_role.yaml
microk8s.kubectl apply -f traefik_role.yaml
microk8s.kubectl apply -f traefik_roleBind.yaml
cd /home/ubuntu/k8sCongfigs/efk
sudo su
// 准备 es 配置
mkdir /var/snap/microk8s/common/mnt/data/elasticsearch-data -p || true
mkdir /var/snap/microk8s/common/mnt/data/elasticsearch-config -p || true
cp config/* /var/snap/microk8s/common/mnt/data/elasticsearch-config -r
microk8s.ctr image import ~/shared/powerssd/images/docker/x86/fluentd-x86-image.tar
microk8s.ctr image import ~/shared/powerssd/images/docker/x86/elasticsearch-8-8-0.tar
microk8s.ctr image import ~/shared/powerssd/images/docker/x86/kibana-8-8-0.tar
// 创建 es 资源
microk8s.kubectl apply -f efk-namespace.yaml
microk8s.kubectl apply -f elasticsearch-deployment.yaml
microk8s.kubectl apply -f elasticsearch-ingress.yaml
microk8s.kubectl apply -f elasticsearch-pv.yaml
microk8s.kubectl apply -f elasticsearch-pvc.yaml
microk8s.kubectl apply -f elasticsearch-service.yaml
// 这个时候正在创建elasticsearch的pod需要拉取镜像大概1个多小时如果有离线的直接导入离线的镜像
sleep 60
./createSecure_passwd_forES.sh
./createFluentdAccoutnIn.sh
microk8s.kubectl apply -f fluentd-configMap.yaml
microk8s.kubectl apply -f fluentd-daemonset.yaml
microk8s.kubectl apply -f fluentd-service.yaml
microk8s.kubectl apply -f fluentd-ingress.yaml
microk8s.kubectl apply -f fluentd-service.yaml
microk8s.kubectl apply -f kibana-deployment.yaml
microk8s.kubectl apply -f kibana-ingress.yaml
microk8s.kubectl apply -f kibana-service.yaml
./refreshTokenForKibana.sh