此 Lab 是為了讓剛進入職場的 SRE 工程師能夠快速掌握 Terraform 及 EFK debug 流程而設計的。Lab 中模擬作者實際在職場上遇到必須將 EFK 進行升級時遇到的問題復現出來。其中包含了 20% Terrform 應用 20% EFK debug 30% EKS TLS 概念 30% 升級時注意事項
You can use ./utilities/check_requirements.sh to check if your settings match the lab requirements.
- Check if you have installed AWS CLI, Terraform, Helm, and kubectl.
- Ensure you can access AWS.
- Verify that you have full access to EKS.
- docker!!!!!
- Below is the infrastructure
tree -L 2
.
├── README.md
├── ec2.tf
├── eks.tf
├── main.tf
├── network.tf
├── utilities
│ ├── destroy.sh
│ ├── init.sh
│ └── remove.sh
├── resource-management
│ ├── data.tf
│ ├── helm_release.tf
│ ├── init-es
│ ├── provider.tf
│ ├── secret.yaml
│ ├── values
│ └── variables.tf
└── variables.tf
- The root folder is for deploying EKS infrastructure and VPC network.
- The resource-management folder is for deploying applications, such as Elasticsearch and Kibana.
- Rewrite the "owner" and "region" variable tag in the
variables.tffile. - Run the following script file, which will build a new EKS cluster and deploy the applications required for the lab:
./init.sh
or
AWS_PROFILE=test ./init.sh
Use the following command to check if the Fluent Bit configuration is set to send logs to Elasticsearch. The lab has already provided the necessary configuration settings in /tasks/task1.md.
kubectl -n kube-system describe configmap fluent-bit
cd resource-management
terraform apply -var-file="../variables.tfvars"
ref:
- artifacthub-elasticsearch[https://artifacthub.io/packages/helm/elastic/elasticsearch]
- artifacthub-fluentbit[https://artifacthub.io/packages/helm/aws/aws-for-fluent-bit]
There are no data displayed in Kibana, which is not correct.
Please check the network, logs, and settings to find out and ensure Kibana receives data from the logs-generator and filters only to display 404 errors.
Below is the port-forward command that can expose Kibana, and you can connect to it at https://localhost:8080:
kubectl -n kube-system port-forward <kibana pod name> 8080:5601
- Only 404 errors can be found in Kibana.
- The current ElasticSearch and kibana version is 7.17.3. It is recommended to upgrade it to 8.5.1.
- An important reminder for ElasticSearch version 8.5.1 is that certificates can be auto-created. Therefore, you may need to adjust some settings related to TLS connections.
- By using the command
helm list -n kube-system, you can see that both ElasticSearch and Kibana versions are 8.5.1.
./destroy.sh
or
AWS_PROFILE=<profile> ./destroy.sh
Sometimes when you rebuild Elasticsearch, you may encounter the "context deadline exceeded" error. This is because when you rebuild ES, it will retain the old Persistent Volume Claim (PVC), which can cause the rebuild process to fail. If you encounter this problem, please run the /resource-management/remove.sh script file, which will delete the dependent deprecated resources.