k8sConfigs/efk/README.md
2025-02-05 04:35:01 +08:00

74 lines
1.9 KiB
Markdown
Raw 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.

## 如何重新创建整个namespace
```
./init.sh
```
```
```
下面都都不用看了, 直接执行上面的语句
先删了 namespace efk这样里面资源就都没了除了pv
然后 microk8s.kubectl create namespace efk
option1
1. 确保已经把本目录下config内容复制到 /var/snap/microk8s/common/mnt/data/elasticsearch-config
- sudo mkdir /var/snap/microk8s/common/mnt/data/elasticsearch-data -p || true
- sudo mkdir /var/snap/microk8s/common/mnt/data/elasticsearch-config -p || true
2. ekf空间下资源部署本目录下所有未被禁用的yaml
- chmod 777 /var/snap/microk8s/common/mnt/data/elasticsearch-config && chmod 777 /var/snap/microk8s/common/mnt/data/elasticsearch-data
- cp config/* /var/snap/microk8s/common/mnt/data/elasticsearch-config -r
- 先装elasticsearch相关
- 执行./createSecure_passwd.sh
此时建议停下来看看elasticsearch的pod的状态是否正常否则后面的步骤没有意义: microk8s.kubectl get all -n efk
- 再装fluentd相关
- 执行 ./createFluentdAccoutnIn.sh
- 最后装kibana相关
--------
option2:
1. 所有yaml都apply完了再 执行这个
```
./createSecure_passwd.sh
```
创建了
账号elastic
密码your_secure_password
2. 然后创建服务账号给kibana, 并重新部署
```
./refreshTokenForKibana.sh
```
3. 确保已经把最新的traefik的loadbalance的ip配置到/etc/nginx/nginx.conf 的upstreeam里
--------------
上述option 二选一
不管怎么样,最后: 浏览http://kibana.k8s.xunlang.home
在kibana的dev tool中执行
```
PUT _index_template/logstash_template
{
"index_patterns": ["logstash-*"],
"template": {
"settings": {
"number_of_replicas": 0
}
}
}
```
如果已经fluentd已经开始上报log需删掉已有index:
```
DELETE _template/logstash_template
DELETE /logstash-2024.11.09
```