How to run kube-bench in my cluster? | Как запустить kube-bench в кластере? |
First, you have to exec in Deckhouse Pod: |
|
shell kubectl -n d8-system exec -ti svc/deckhouse-leader -c deckhouse – bash | shell kubectl -n d8-system exec -ti svc/deckhouse-leader -c deckhouse – bash |
Then you have to select which node you want to run kube-bench. |
|
|
|
shell curl -s https://raw.githubusercontent.com/aquasecurity/kube-bench/main/job.yaml | kubectl create -f - | shell curl -s https://raw.githubusercontent.com/aquasecurity/kube-bench/main/job.yaml | kubectl create -f - |
|
|
shell curl -s https://raw.githubusercontent.com/aquasecurity/kube-bench/main/job.yaml | kubectl apply -f - –dry-run=client -o json | jq ‘.spec.template.spec.tolerations=[{“operator”: “Exists”}] | .spec.template.spec.nodeSelector={“node-role.kubernetes.io/control-plane”: “”}’ | kubectl create -f - | shell curl -s https://raw.githubusercontent.com/aquasecurity/kube-bench/main/job.yaml | kubectl apply -f - –dry-run=client -o json | jq ‘.spec.template.spec.tolerations=[{“operator”: “Exists”}] | .spec.template.spec.nodeSelector={“node-role.kubernetes.io/control-plane”: “”}’ | kubectl create -f - |
Then you can check report: |
|
shell kubectl logs job.batch/kube-bench | shell kubectl logs job.batch/kube-bench |
Deckhouse set the log retention period to 7 days. However, according to the security requirements specified in kube-bench, logs should be retained for at least 30 days. Use separate storage for logs if you need to keep logs for more than 7 days. | В Deckhouse установлен срок хранения логов — 7 дней. Однако, в соответствии с требованиями безопасности указанными в kube-bench, логи должны храниться не менее 30 дней. Используйте отдельное хранилище для логов, если вам необходимо хранить логи более 7 дней. |
How to collect debug info? | Как собрать информацию для отладки? |
We always appreciate helping users with debugging complex issues. Please follow these steps so that we can help you: | Мы всегда рады помочь пользователям с расследованием сложных проблем. Пожалуйста, выполните следующие шаги, чтобы мы смогли вам помочь: |
|
|
sh
kubectl -n d8-system exec svc/deckhouse-leader -c deckhouse
| sh
kubectl -n d8-system exec svc/deckhouse-leader -c deckhouse
|
|
|
Data that will be collected:
| Данные, которые будут собраны: |
How to debug pod problems with ephemeral containers? |
|
Run the following command: | Как отлаживать проблемы в подах с помощью ephemeral containers? |
shell
kubectl -n | Выполните следующую команду: |
More info in official documentation. | shell
kubectl -n |
How to debug node problems with ephemeral containers? | Подробнее можно почитать в официальной документации. |
Run the following command: | Как отлаживать проблемы на узлах с помощью ephemeral containers? |
shell kubectl debug node/mynode -it –image=ubuntu | Выполните следующую команду: |
More info in official documentation. | shell kubectl debug node/mynode -it –image=ubuntu |
Подробнее можно почитать в официальной документации. |