Policy Controller 隨附預設的限制範本庫,可以與 CIS 套裝組合搭配使用,稽核叢集是否符合 CIS Kubernetes 基準 v1.7.1。這項基準由多項建議組成,可協助您設定 Kubernetes 來支援功能強大的安全防護措施。
本頁說明如何手動套用政策組合。 或者,您也可以直接套用政策組合。
如果您是 IT 管理員和營運人員,想確保雲端平台中執行的所有資源都符合機構的法規遵循規定,請參閱本頁面,瞭解如何提供及維護自動化稽核或強制執行功能。如要進一步瞭解我們在內容中提及的常見角色和範例工作,請參閱「常見的 GKE Enterprise 使用者角色和工作」。 Google Cloud
這組限制條件可解決並強制執行下列領域的政策:
- RBAC 和服務帳戶
- Pod 安全性政策
- 網路政策和 CNI
- 密鑰管理
- 可擴充的許可控制
- 一般政策
CIS Kubernetes v1.7.1 政策套裝組合限制
限制名稱 | 限制說明 | 控制項 ID |
---|---|---|
cis-k8s-v1.7.1-restrict-system-masters-group | 禁止使用 system:masters 群組。稽核期間無效。
|
5.1.7 |
cis-k8s-v1.7.1-restrict-env-var-secrets | 限制在容器定義中使用密鑰做為環境變數。 | 5.4.1 |
cis-k8s-v1.7.1-restrict-capabilities | 容器必須捨棄 NET_RAW 功能,且不得新增任何功能。
|
5.2.8、5.2.9、5.2.10 |
cis-k8s-v1.7.1-require-admission-controller | 需要 Pod 安全性許可或外部政策控管系統。 | 5.2.1 |
cis-k8s-v1.7.1-require-binauthz | 需要二進位授權驗證許可控制器 Webhook。 | 5.5.1 |
cis-k8s-v1.7.1-require-namespace-networkpolicy | 叢集中定義的每個命名空間都必須有 NetworkPolicy 。
|
5.3.2 |
cis-k8s-v1.7.1-require-seccomp-default | Pod 的 seccomp 設定檔必須設為 runtime/default 或 docker/default 。
|
5.7.2 |
cis-k8s-v1.7.1-require-securitycontext | Pod 必須定義 securityContext 。
|
5.7.3 |
cis-k8s-v1.7.1-restrict-aggregation-controller | 限制使用 clusterrole-aggregation-controller 角色。
|
5.1.8 |
cis-k8s-v1.7.1-restrict-automountserviceaccounttoken | 限制服務帳戶權杖的使用。 | 5.1.5、5.1.6 |
cis-k8s-v1.7.1-restrict-bind-escalate-impersonate | 限制存取 Roles 和 ClusterRoles 中的 bind、escalate、impersonate。
|
5.1.8 |
cis-k8s-v1.7.1-restrict-certificatesigningrequests-approval | 限制用戶端憑證核准 API 的存取權。 | 5.1.11 |
cis-k8s-v1.7.1-restrict-cluster-admin-role | 限制使用 cluster-admin 角色。
|
5.1.1、5.1.8 |
cis-k8s-v1.7.1-restrict-creation-with-default-serviceaccount | 限制使用預設服務帳戶建立資源。稽核期間無效。 | 5.1.5 |
cis-k8s-v1.7.1-restrict-default-namespace | 禁止 Pod 使用預設命名空間。 | 5.7.1、5.7.4 |
cis-k8s-v1.7.1-restrict-host-namespace | 限制將 hostPID 或 hostIPC 設為 true 的容器。
|
5.2.3、5.2.4 |
cis-k8s-v1.7.1-restrict-host-port | 禁止容器以設定的 hostPort 執行。
|
5.2.13 |
cis-k8s-v1.7.1-restrict-hostpath-volumes | 限制使用 hostPath 磁碟區。
|
5.2.12 |
cis-k8s-v1.7.1-restrict-hostnetwork | 禁止容器在 hostNetwork 旗標設為 true 的情況下執行。
|
5.2.5 |
cis-k8s-v1.7.1-restrict-nodes-proxy | 限制對 Roles 和 ClusterRoles 中節點的 Proxy 子資源存取權。
|
5.1.10 |
cis-k8s-v1.7.1-restrict-persistent-volume | 限制在 Roles 和 ClusterRoles 中建立 persistentvolumes 。
|
5.1.9 |
cis-k8s-v1.7.1-restrict-pods-create | 限制在 Roles 和 ClusterRoles 中建立 Pod。
|
5.1.4 |
cis-k8s-v1.7.1-restrict-privilege-escalation | 限制容器,並將 allowPrivilegeEscalation 設為 true 。
|
5.2.6 |
cis-k8s-v1.7.1-restrict-privileged-containers | 限制容器,並將 securityContext.privileged 設為 true 。
|
5.2.2 |
cis-k8s-v1.7.1-restrict-role-secrets | 限制在 Roles 和 ClusterRoles 中使用密鑰。
|
5.1.2 |
cis-k8s-v1.7.1-restrict-role-wildcards | 限制在 Roles 和 ClusterRoles 中使用萬用字元。
|
5.1.3 |
cis-k8s-v1.7.1-restrict-root-containers | 限制容器以超級使用者身分執行。 | 5.2.7 |
cis-k8s-v1.7.1-restrict-secrets-of-type-basic-auth | 限制使用 basic-auth 類型的密碼。
|
5.4.2 |
cis-k8s-v1.7.1-restrict-serviceaccounts-token | 限制在 Roles 和 ClusterRoles 中建立 serviceaccount 權杖。
|
5.1.13 |
cis-k8s-v1.7.1-restrict-webhook-config | 限制存取 Roles 和 ClusterRoles 中的 Webhook 設定物件。
|
5.1.12 |
cis-k8s-v1.7.1-restrict-windows-hostprocess | 限制執行 Windows hostProcess 容器或 Pod。
|
5.2.11 |
事前準備
- 安裝並初始化 Google Cloud CLI,其中提供這些操作說明中使用的
gcloud
和kubectl
指令。如果您使用 Cloud Shell,Google Cloud CLI 會預先安裝。 - 在叢集上安裝 Policy Controller,並使用預設的限制範本庫。此外,由於這個套裝組合包含參照限制,您也必須啟用參照限制支援。
設定參照完整性限制
將下列 YAML 資訊清單儲存為
policycontroller-config.yaml
檔案。 資訊清單會設定 Policy Controller,監控特定種類的物件。apiVersion: config.gatekeeper.sh/v1alpha1 kind: Config metadata: name: config namespace: "gatekeeper-system" spec: sync: syncOnly: - group: "admissionregistration.k8s.io" version: "v1" kind: "ValidatingWebhookConfiguration" - group: "networking.k8s.io" version: "v1" kind: "NetworkPolicy"
套用
policycontroller-config.yaml
資訊清單:kubectl apply -f policycontroller-config.yaml
設定叢集和工作負載
- 您必須在
cis-k8s-v1.7.1-require-binauthz
中啟用及設定二進位授權。
稽核 CIS Kubernetes v1.7.1 政策套裝組合
您可以透過 Policy Controller,對 Kubernetes 叢集強制執行政策。如要測試工作負載是否符合上表列出的 CIS Kubernetes v1.7.1 政策,您可以「稽核」模式部署這些限制,找出並解決違規問題。
您可以使用 kubectl、kpt 或 Config Sync,將 spec.enforcementAction
設為 dryrun
來套用這些政策。
kubectl
(選用) 使用 kubectl 預覽政策限制:
kubectl kustomize https://github.com/GoogleCloudPlatform/gke-policy-library.git/anthos-bundles/cis-k8s-v1.7.1
使用 kubectl 套用政策限制:
kubectl apply -k https://github.com/GoogleCloudPlatform/gke-policy-library.git/anthos-bundles/cis-k8s-v1.7.1
輸出內容如下:
k8savoiduseofsystemmastersgroup.constraints.gatekeeper.sh/cis-k8s-v1.7.1-avoid-use-of-system-masters-group created k8sblockcreationwithdefaultserviceaccount.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-creation-with-default-serviceaccount created k8sblockobjectsoftype.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-secrets-of-type-basic-auth created k8snoenvvarsecrets.constraints.gatekeeper.sh/cis-k8s-v1.7.1-no-secrets-as-env-vars created k8spspallowprivilegeescalationcontainer.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-privilege-escalation created k8spspallowedusers.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-root-containers created k8spspcapabilities.constraints.gatekeeper.sh/cis-k8s-v1.7.1-psp-capabilities created k8spsphostfilesystem.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-hostpath-volumes created k8spsphostnamespace.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-host-namespace created k8spsphostnetworkingports.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-host-port created k8spsphostnetworkingports.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-hostnetwork created k8spspprivilegedcontainer.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-privileged-containers created k8spspseccomp.constraints.gatekeeper.sh/cis-k8s-v1.7.1-require-seccomp-default created k8spspwindowshostprocess.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-windows-hostprocess created k8spodsrequiresecuritycontext.constraints.gatekeeper.sh/cis-k8s-v1.7.1-require-securitycontext created k8sprohibitrolewildcardaccess.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-role-wildcards created k8srequireadmissioncontroller.constraints.gatekeeper.sh/cis-k8s-v1.7.1-require-admission-controller created k8srequirebinauthz.constraints.gatekeeper.sh/cis-k8s-v1.7.1-require-binauthz created k8srequirenamespacenetworkpolicies.constraints.gatekeeper.sh/cis-k8s-v1.7.1-require-namespace-networkpolicy created k8srestrictautomountserviceaccounttokens.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-automountserviceaccounttoken created k8srestrictnamespaces.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-default-namespace created k8srestrictrolebindings.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-aggregation-controller created k8srestrictrolebindings.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-cluster-admin-role created k8srestrictrolerules.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-bind-escalate-impersonate created k8srestrictrolerules.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-certificatesigningrequests-approval created k8srestrictrolerules.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-nodes-proxy created k8srestrictrolerules.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-persistent-volume created k8srestrictrolerules.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-pods-create created k8srestrictrolerules.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-role-secrets created k8srestrictrolerules.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-serviceaccounts-token created k8srestrictrolerules.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-webhook-config created
確認已安裝政策限制,並檢查叢集是否發生違規情形:
kubectl get constraints -l policycontroller.gke.io/bundleName=cis-k8s-v1.7.1
輸出結果會與下列內容相似:
NAME ENFORCEMENT-ACTION TOTAL-VIOLATIONS k8spspallowprivilegeescalationcontainer.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-privilege-escalation dryrun 0 NAME ENFORCEMENT-ACTION TOTAL-VIOLATIONS k8sblockcreationwithdefaultserviceaccount.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-creation-with-default-serviceaccount dryrun 0 NAME ENFORCEMENT-ACTION TOTAL-VIOLATIONS k8sprohibitrolewildcardaccess.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-role-wildcards dryrun 0 NAME ENFORCEMENT-ACTION TOTAL-VIOLATIONS k8srequirebinauthz.constraints.gatekeeper.sh/cis-k8s-v1.7.1-require-binauthz dryrun 0 NAME ENFORCEMENT-ACTION TOTAL-VIOLATIONS k8srequireadmissioncontroller.constraints.gatekeeper.sh/cis-k8s-v1.7.1-require-admission-controller dryrun 0 NAME ENFORCEMENT-ACTION TOTAL-VIOLATIONS k8spspwindowshostprocess.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-windows-hostprocess dryrun 0 NAME ENFORCEMENT-ACTION TOTAL-VIOLATIONS k8spsphostnetworkingports.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-host-port dryrun 0 k8spsphostnetworkingports.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-hostnetwork dryrun 0 NAME ENFORCEMENT-ACTION TOTAL-VIOLATIONS k8srestrictautomountserviceaccounttokens.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-automountserviceaccounttoken dryrun 0 NAME ENFORCEMENT-ACTION TOTAL-VIOLATIONS k8spodsrequiresecuritycontext.constraints.gatekeeper.sh/cis-k8s-v1.7.1-require-securitycontext dryrun 0 NAME ENFORCEMENT-ACTION TOTAL-VIOLATIONS k8spsphostfilesystem.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-hostpath-volumes dryrun 0 NAME ENFORCEMENT-ACTION TOTAL-VIOLATIONS k8spspprivilegedcontainer.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-privileged-containers dryrun 0 NAME ENFORCEMENT-ACTION TOTAL-VIOLATIONS k8spspseccomp.constraints.gatekeeper.sh/cis-k8s-v1.7.1-require-seccomp-default dryrun 0 NAME ENFORCEMENT-ACTION TOTAL-VIOLATIONS k8srestrictrolebindings.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-aggregation-controller dryrun 0 k8srestrictrolebindings.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-cluster-admin-role dryrun 0 NAME ENFORCEMENT-ACTION TOTAL-VIOLATIONS k8srestrictrolerules.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-bind-escalate-impersonate dryrun 0 k8srestrictrolerules.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-certificatesigningrequests-approval dryrun 0 k8srestrictrolerules.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-nodes-proxy dryrun 0 k8srestrictrolerules.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-persistent-volume dryrun 0 k8srestrictrolerules.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-pods-create dryrun 0 k8srestrictrolerules.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-role-secrets dryrun 0 k8srestrictrolerules.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-serviceaccounts-token dryrun 0 k8srestrictrolerules.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-webhook-config dryrun 0 NAME ENFORCEMENT-ACTION TOTAL-VIOLATIONS k8spspallowedusers.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-root-containers dryrun 0 NAME ENFORCEMENT-ACTION TOTAL-VIOLATIONS k8srequirenamespacenetworkpolicies.constraints.gatekeeper.sh/cis-k8s-v1.7.1-require-namespace-networkpolicy dryrun 0 NAME ENFORCEMENT-ACTION TOTAL-VIOLATIONS k8savoiduseofsystemmastersgroup.constraints.gatekeeper.sh/cis-k8s-v1.7.1-avoid-use-of-system-masters-group dryrun 0 NAME ENFORCEMENT-ACTION TOTAL-VIOLATIONS k8snoenvvarsecrets.constraints.gatekeeper.sh/cis-k8s-v1.7.1-no-secrets-as-env-vars dryrun 0 NAME ENFORCEMENT-ACTION TOTAL-VIOLATIONS k8sblockobjectsoftype.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-secrets-of-type-basic-auth dryrun 0 NAME ENFORCEMENT-ACTION TOTAL-VIOLATIONS k8spsphostnamespace.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-host-namespace dryrun 0 NAME ENFORCEMENT-ACTION TOTAL-VIOLATIONS k8srestrictnamespaces.constraints.gatekeeper.sh/cis-k8s-v1.7.1-restrict-default-namespace dryrun 0 NAME ENFORCEMENT-ACTION TOTAL-VIOLATIONS k8spspcapabilities.constraints.gatekeeper.sh/cis-k8s-v1.7.1-psp-capabilities dryrun 0
KPT
安裝及設定 kpt。這些操作說明會使用 kpt 自訂及部署 Kubernetes 資源。
使用 kpt 從 GitHub 下載 CIS 政策套裝組合:
kpt pkg get https://github.com/GoogleCloudPlatform/gke-policy-library.git/anthos-bundles/cis-k8s-v1.7.1
執行
set-enforcement-action
kpt 函式,將政策的強制執行動作設為dryrun
:kpt fn eval cis-k8s-v1.7.1 -i gcr.io/kpt-fn/set-enforcement-action:v0.1 \ -- enforcementAction=dryrun
使用 kpt 初始化工作目錄,這會建立資源來追蹤變更:
cd cis-k8s-v1.7.1 kpt live init
使用 kpt 套用政策限制:
kpt live apply
確認已安裝政策限制,並檢查叢集是否發生違規情形:
kpt live status --output table --poll-until current
狀態為
CURRENT
,表示限制條件已成功安裝。
Config Sync
- 安裝及設定 kpt。這些操作說明會使用 kpt 自訂及部署 Kubernetes 資源。
如果運算子使用 Config Sync 將政策部署至叢集,可以按照下列指示操作:
變更為 Config Sync 的同步目錄:
cd SYNC_ROOT_DIR
如要使用
resourcegroup.yaml
建立或附加.gitignore
,請按照下列步驟操作:echo resourcegroup.yaml >> .gitignore
建立專屬的
policies
目錄:mkdir -p policies
使用 kpt 從 GitHub 下載 CIS Kubernetes v1.7.1 政策套裝組合:
kpt pkg get https://github.com/GoogleCloudPlatform/gke-policy-library.git/anthos-bundles/cis-k8s-v1.7.1 policies/cis-k8s-v1.7.1
執行
set-enforcement-action
kpt 函式,將政策的強制執行動作設為dryrun
:kpt fn eval policies/cis-k8s-v1.7.1 -i gcr.io/kpt-fn/set-enforcement-action:v0.1 -- enforcementAction=dryrun
(選用) 預覽要建立的政策限制:
kpt live init policies/cis-k8s-v1.7.1 kpt live apply --dry-run policies/cis-k8s-v1.7.1
如果 Config Sync 的同步目錄使用 Kustomize,請將
policies/cis-k8s-v1.7.1
新增至根kustomization.yaml
。否則請移除policies/cis-k8s-v1.7.1/kustomization.yaml
檔案:rm SYNC_ROOT_DIR/policies/cis-k8s-v1.7.1/kustomization.yaml
將變更推送至 Config Sync 存放區:
git add SYNC_ROOT_DIR/policies/cis-k8s-v1.7.1 git commit -m 'Adding CIS Kubernetes v1.7.1 policy bundle' git push
驗證安裝狀態:
watch gcloud beta container fleet config-management status --project PROJECT_ID
如果狀態為
SYNCED
,表示政策已安裝完成。
查看政策違規事項
在稽核模式下安裝政策限制後,您可以使用 Policy Controller 資訊主頁,在 UI 中查看叢集的違規情形。
您也可以使用 kubectl
,透過下列指令查看叢集上的違規事項:
kubectl get constraint -l policycontroller.gke.io/bundleName=cis-k8s-v1.7.1 -o json | jq -cC '.items[]| [.metadata.name,.status.totalViolations]'
如有違規事項,可使用下列指令查看每個限制的違規訊息清單:
kubectl get constraint -l policycontroller.gke.io/bundleName=cis-k8s-v1.7.1 -o json | jq -C '.items[]| select(.status.totalViolations>0)| [.metadata.name,.status.violations[]?]'
變更 CIS Kubernetes v1.7.1 政策套裝組合強制執行動作
審查叢集中的政策違規事項後,您可以考慮變更強制執行模式,讓 Admission Controller warn
或 deny
阻止不符規定的資源套用至叢集。
kubectl
使用 kubectl 將政策的強制執行動作設為
warn
:kubectl get constraint -l policycontroller.gke.io/bundleName=cis-k8s-v1.7.1 -o name | xargs -I {} kubectl patch {} --type='json' -p='[{"op":"replace","path":"/spec/enforcementAction","value":"warn"}]'
確認政策限制強制執行動作已更新:
kubectl get constraints -l policycontroller.gke.io/bundleName=cis-k8s-v1.7.1
KPT
執行
set-enforcement-action
kpt 函式,將政策的強制執行動作設為warn
:kpt fn eval -i gcr.io/kpt-fn/set-enforcement-action:v0.1 -- enforcementAction=warn
套用政策限制:
kpt live apply
Config Sync
如果運算子使用 Config Sync 將政策部署至叢集,可以按照下列指示操作:
變更為 Config Sync 的同步目錄:
cd SYNC_ROOT_DIR
執行
set-enforcement-action
kpt 函式,將政策的強制執行動作設為warn
:kpt fn eval policies/cis-k8s-v1.7.1 -i gcr.io/kpt-fn/set-enforcement-action:v0.1 -- enforcementAction=warn
將變更推送至 Config Sync 存放區:
git add SYNC_ROOT_DIR/policies/cis-k8s-v1.7.1 git commit -m 'Adding CIS Kubernetes v1.7.1 policy bundle warn enforcement' git push
驗證安裝狀態:
nomos status
叢集應顯示
SYNCED
狀態,並列出已安裝的政策。
測試政策強制執行
使用下列指令在叢集上建立不符規定的資源:
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
namespace: default
name: wp-non-compliant
labels:
app: wordpress
spec:
containers:
- image: wordpress
name: wordpress
ports:
- containerPort: 80
name: wordpress
EOF
准入控制器應會產生警告,列出這項資源違反的政策,如下列範例所示:
Warning: [cis-k8s-v1.7.1-restrict-default-namespace] <default> namespace is restricted Warning: [cis-k8s-v1.7.1-restrict-root-containers] Container wordpress is attempting to run without a required securityContext/runAsNonRoot or securityContext/runAsUser != 0 Warning: [cis-k8s-v1.7.1-restrict-privilege-escalation] Privilege escalation container is not allowed: wordpress Warning: [cis-k8s-v1.7.1-require-seccomp-default] Seccomp profile 'not configured' is not allowed for container 'wordpress'. Found at: no explicit profile found. Allowed profiles: {"RuntimeDefault", "docker/default", "runtime/default"} Warning: [cis-k8s-v1.7.1-psp-capabilities] container <wordpress> is not dropping all required capabilities. Container must drop all of ["NET_RAW"] or "ALL" Warning: [cis-k8s-v1.7.1-require-securitycontext] securityContext must be defined for all Pod containers pod/wp-non-compliant created
移除 CIS Kubernetes v1.7.1 政策套裝組合
如有需要,可以從叢集移除 CIS Kubernetes v1.7.1 政策套裝組合。
kubectl
使用 kubectl 移除政策:
kubectl delete constraint -l policycontroller.gke.io/bundleName=cis-k8s-v1.7.1
KPT
移除政策:
kpt live destroy
Config Sync
如果運算子使用 Config Sync 將政策部署至叢集,可以按照下列指示操作:
將變更推送至 Config Sync 存放區:
git rm -r SYNC_ROOT_DIR/policies/cis-k8s-v1.7.1 git commit -m 'Removing CIS Kubernetes v1.7.1 policy bundle' git push
確認狀態:
nomos status
叢集應會顯示
SYNCED
狀態,且資源已移除。