ACK叢集容器安全性原則供了種類豐富的內建規則庫,包括Compliance、Infra、K8s-general和PSP,旨在確保容器在生產環境中的安全運行。您可以調用DescribePolicyGovernanceInCluster介面,查詢目的地組群策略治理的詳細資料,例如叢集當前啟用的不同等級策略計數統計、策略治理審計日誌、攔截和警示情況等。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
|
操作 |
存取層級 |
資源類型 |
條件關鍵字 |
關聯操作 |
|
cs:DescribePolicyGovernanceInCluster |
get |
*Cluster
|
無 | 無 |
請求文法
GET /clusters/{cluster_id}/policygovernance HTTP/1.1
路徑參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| cluster_id |
string |
是 |
目的地組群 ID |
c8155823d057948c69a**** |
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
當前API無需請求參數
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
Schema of Response |
||
| on_state |
array<object> |
當前叢集中開啟的不同等級策略計數統計。 |
|
|
object |
|||
| enabled_count |
integer |
當前開啟的策略種類計數。 |
3 |
| total |
integer |
該等級下策略種類總數。 |
8 |
| severity |
string |
策略治理等級。 |
high |
| admit_log |
object |
叢集當前策略治理審計日誌。 |
|
| progress |
string |
查詢結果的狀態,取值:
|
Complete |
| count |
integer |
當前查詢到的日誌總數。 |
100 |
| logs |
array<object> |
違反策略的日誌資訊。 |
|
|
object |
|||
| cluster_id |
string |
叢集 ID。 |
hash code |
| constraint_action |
string |
策略作用動作,包括警示(warn)和攔截(deny)
|
deny |
| constraint_api_version |
string |
策略的 API 版本。 |
v1beta1 |
| constraint_category |
string |
策略類型。 |
cis-k8s |
| constraint_group |
string |
策略的 API 組。 |
constraints.gatekeeper.sh |
| constraint_kind |
string |
對應策略管理中的策略名稱稱。 |
ACKNamespacesDeleteProtection |
| constraint_name |
string |
策略執行個體名稱。 |
namespace-delete-protection-jpjwv |
| event_msg |
string |
策略作用的詳細資料。 |
Admission webhook \"validation.gatekeeper.sh\" denied request, Resource Namespace: , Constraint: namespace-delete-protection-jpjwv, Message: not allow to delete protection namespace test. |
| event_type |
string |
策略觸發事件的類型,例如 violation。 |
violation |
| request_uid |
string |
請求 ID。 |
hash code |
| request_userinfo |
string |
違反策略的請求使用者資訊。 |
account id |
| request_username |
string |
違反策略的請求使用者名稱稱。 |
account user name |
| resource_kind |
string |
違反策略的資源類型,例如操作 Namespace 的請求被駁回,此項的內容為:Namespace。 |
Namespace |
| resource_name |
string |
違反策略的資源名稱。 |
test |
| time |
string |
策略違反時間。 |
2025-10-27T11:31:40Z |
| log_project |
string |
儲存策略作用資訊的記錄項目。 |
k8s-log-clusterid |
| log_store |
string |
儲存策略作用資訊的日誌倉庫。 |
policyadmit-clusterid |
| Violation |
object |
按嚴重程度匯總的違反策略資訊。 |
|
| totalViolations |
object |
匯總資訊。 |
|
| deny |
array<object> |
攔截記錄匯總。 |
|
|
object |
|||
| severity |
string |
嚴重程度。包括:low,medium,high。 |
medium |
| violations |
string |
違反次數。 |
2 |
| warn |
array<object> |
警示記錄匯總。 |
|
|
object |
|||
| severity |
string |
嚴重程度匯總。 |
high |
| violations |
integer |
違反次數匯總。 |
0 |
| violations |
object |
按策略名稱稱匯總的違反記錄。 |
|
| deny |
array<object> |
攔截記錄匯總。 |
|
|
object |
|||
| policyDescription |
string |
策略描述。 |
Prevent specific namespaces from being deleted. |
| policyName |
string |
策略名稱稱。 |
ACKNamespacesDeleteProtection |
| severity |
string |
嚴重程度。 |
medium |
| violations |
integer |
違反次數。 |
1 |
| warn |
array<object> |
警示資訊匯總。 |
|
|
object |
|||
| policyDescription |
string |
策略描述。 |
|
| policyName |
string |
策略名稱稱。 |
|
| severity |
string |
嚴重程度。 |
|
| violations |
integer |
違反次數。 |
樣本
正常返回樣本
JSON格式
{
"on_state": [
{
"enabled_count": 3,
"total": 8,
"severity": "high"
}
],
"admit_log": {
"progress": "Complete",
"count": 100,
"logs": [
{
"cluster_id": "hash code",
"constraint_action": "deny",
"constraint_api_version": "v1beta1",
"constraint_category": "cis-k8s",
"constraint_group": "constraints.gatekeeper.sh",
"constraint_kind": "ACKNamespacesDeleteProtection",
"constraint_name": "namespace-delete-protection-jpjwv",
"event_msg": "Admission webhook \\\"validation.gatekeeper.sh\\\" denied request, Resource Namespace: , Constraint: namespace-delete-protection-jpjwv, Message: not allow to delete protection namespace test.",
"event_type": "violation",
"request_uid": "hash code",
"request_userinfo": "account id",
"request_username": "account user name\n",
"resource_kind": "Namespace",
"resource_name": "test",
"time": "2025-10-27T11:31:40Z"
}
],
"log_project": "k8s-log-clusterid",
"log_store": "policyadmit-clusterid"
},
"Violation": {
"totalViolations": {
"deny": [
{
"severity": "medium",
"violations": "2"
}
],
"warn": [
{
"severity": "high",
"violations": 0
}
]
},
"violations": {
"deny": [
{
"policyDescription": "Prevent specific namespaces from being deleted.",
"policyName": "ACKNamespacesDeleteProtection",
"severity": "medium",
"violations": 1
}
],
"warn": [
{
"policyDescription": "",
"policyName": "",
"severity": "",
"violations": 0
}
]
}
}
}
錯誤碼
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。