synchronization

This commit is contained in:
2025-08-25 17:53:08 +08:00
commit c201eb5ef9
318 changed files with 23092 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
> 本文作者:丁辉
# 查看Kubernetes内所有特权容器
1. 安装 JQ
- Centos
```bash
yum -y install jq
```
- Ubuntu
```bash
apt -y install jq
```
2. 查找特权容器
- 查找特权容器并输出命名空间、容器名
```bash
kubectl get pods --all-namespaces -o json | jq '.items[] | select(.spec.containers[].securityContext.privileged==true) | {namespace: .metadata.namespace, pod: .metadata.name}'
```
- 查找特权容器并输出命名空间、容器名、容器端口
```bash
kubectl get pods --all-namespaces -o json | jq '.items[] | select(.spec.containers[].securityContext.privileged==true) | {namespace: .metadata.namespace, pod: .metadata.name, ports: .spec.containers[].ports}'
```