使用 Helm 圖表在 Red Hat OpenShift 中管理 Workload Protection 代理程式
您可以使用 Helm 圖表在 Red Hat OpenShift 叢集上安裝、升級和刪除 Workload Protection 代理。
您也可以使用控制台,將現有的 Red Hat OpenShift 或 Kubernetes 叢集連接到您的 Workload Protection 實例。 在 IBM Cloud 控制台中,前往「容器」>「叢集」 以存取現有的叢集。 接著,請在「Workload Protection」小工具中點擊 「連線」,將您的叢集連線至 Workload Protection。
開始之前
-
請在您的本地電腦上安裝 Helm CLI 的最新版本。 Helm 需要 3.6 或更新版本。
-
安裝 IBM Cloud CLI、Kubernetes Service 外掛程式、IBM Cloud Container Registry 外掛程式,以及 Red Hat OpenShift 和 Kubernetes CLI。 如需更多資訊,請參閱「安裝 CLI」。
-
請確認您擁有在叢集上部署 Workload Protection 代理程式所需的存取權限與授權。
-
請確認您的叢集中是否已啟用「
ibm-observe」專案。 代理程式已部署在此專案中。專案是叢集中的名稱空間。
要建立此專案,請執行
oc adm new-project --node-selector='' ibm-observe。 -
請確認從您的叢集發往 Workload Protection 端點的出站流量,在
443和6443埠上已獲准通過。 若您是透過虛擬私有端點 (VPE) 連接各代理程式,則必須允許這兩個埠從叢集發送外發流量。
部署代理程式
請依照以下步驟,使用 Helm 部署代理程式。
設定叢集上下文
-
請登入您的帳戶。 如果您有聯合帳戶,請包含
--sso選項。ibmcloud login [-g <resource_group>] [--sso] -
將叢集的
kubeconfig配置檔下載並新增至~/.kube/config中的現有kubeconfig或KUBECONFIG環境變數中的最後一個檔案。ibmcloud oc cluster config --cluster <cluster_name_or_ID> -
在瀏覽器中,請前往您的叢集控制器網址 URL,並在網址後方加上
/console。 例如,https://c0.containers.cloud.ibm.com:23652/console。 -
在 Red Hat OpenShift 網頁控制台的選單列中,點選您的個人檔案 IAM#user.name@email.com > 複製登入指令。 將
oc login記號指令顯示並複製到指令行,以從 CLI 進行鑑別。 -
透過檢查版本,驗證
oc指令是否針對您的叢集正常執行。oc version輸出範例:
Client Version: v4.11.0 Kubernetes Version: v1.25.8.2若您無法執行需要管理員權限的操作(例如列出叢集中的所有工作節點或 Pod),請執行
ibmcloud oc cluster config --cluster <cluster_name_or_ID> --admin指令,下載該叢集管理員的 TLS 憑證及權限檔案。
設定 Sysdig 的 Helm 儲存庫
將 Workload Protection Helm 儲存庫新增至 Helm 實例。
-
新增 Helm 儲存庫。
helm repo add sysdig https://charts.sysdig.com -
更新儲存庫,以取得所有 Helm 圖表的最新版本。
helm repo update -
列出 Sysdig 儲存庫中目前可用的 Helm 圖表。
helm search repo sysdig -
請確認「
sysdig/sysdig-deploy」Helm 圖表是否已列出。
建立名為 YAML 的值檔案
定義一個 YAML 檔案,並在其中包含用於部署 Workload Protection 代理程式以及您計劃部署的 Secure 元件的相關值。 例如,將檔案命名為 agent-values-monitor-secure.yaml。
以下 YAML 是一個範本,您可以藉此設定 Workload Protection 代理程式及 Secure 元件。 您可以透過移除或使用 # 註解掉您的代理程式不需要的區段,來自訂該檔案。
agent:
ebpf:
enabled: true
kind: universal_ebpf
collectorSettings:
collectorHost: INGESTION_ENDPOINT
sysdig:
settings:
host_scanner:
enabled: true
kspm_analyzer:
enabled: true
sysdig_api_endpoint: API_ENDPOINT
extraVolumes:
volumes:
- name: root-vol
hostPath:
path: /
- name: tmp-vol
hostPath:
path: /tmp
mounts:
- mountPath: /host
name: root-vol
readOnly: true
- mountPath: /host/tmp
name: tmp-vol
global:
imageRegistry: icr.io/ext
clusterConfig:
name: CLUSTER_NAME
sysdig:
accessKey: SERVICE_ACCESS_KEY
apiHost: API_ENDPOINT
nodeAnalyzer:
enabled: false
clusterShield:
enabled: true
cluster_shield:
sysdig_endpoint:
region: custom
collector: INGESTION_ENDPOINT:6443
log_level: info
features:
admission_control:
enabled: true
container_vulnerability_management:
enabled: true
dry_run: false
container_vulnerability_management:
enabled: true
audit:
enabled: true
posture:
enabled: true
其中:
CLUSTER_NAME- 您正在部署代理程式的叢集名稱。
SERVICE_ACCESS_KEY- Workload Protection 實例的存取金鑰。
INGESTION_ENDPOINT- 該實例的資料匯入端點。 例如,
ingest.us-east.security-compliance-secure.cloud.ibm.com。 API_ENDPOINT- 該實例的 API 端點。 例如,
us-east.security-compliance-secure.cloud.ibm.com。
安裝「Helm」圖表
若要部署代理程式、Secure 元件,或兩者皆部署,請安裝「sysdig/sysdig-deploy」圖表,並使用您在上一步驟中設定的變數檔案「YAML」。
執行下列指令,以使用 Helm Chart 來安裝代理程式:
helm install -n ibm-observe sysdig-agent sysdig/sysdig-deploy -f agent-values-monitor-secure.yaml
以下範例展示了一個針對 us-east 地區的 Helm 值檔案範例:
agent:
ebpf:
enabled: true
kind: universal_ebpf
collectorSettings:
collectorHost: ingest.private.us-east.security-compliance-secure.cloud.ibm.com
sysdig:
settings:
host_scanner:
enabled: true
kspm_analyzer:
enabled: true
sysdig_api_endpoint: private.us-east.security-compliance-secure.cloud.ibm.com
extraVolumes:
volumes:
- name: root-vol
hostPath:
path: /
- name: tmp-vol
hostPath:
path: /tmp
mounts:
- mountPath: /host
name: root-vol
readOnly: true
- mountPath: /host/tmp
name: tmp-vol
global:
imageRegistry: icr.io/ext
clusterConfig:
name: my-cluster
sysdig:
accessKey: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
apiHost: private.us-east.security-compliance-secure.cloud.ibm.com
nodeAnalyzer:
enabled: false
clusterShield:
enabled: true
cluster_shield:
sysdig_endpoint:
region: custom
collector: ingest.private.us-east.security-compliance-secure.cloud.ibm.com:6443
log_level: info
features:
admission_control:
enabled: true
container_vulnerability_management:
enabled: true
dry_run: false
container_vulnerability_management:
enabled: true
audit:
enabled: true
posture:
enabled: true
更新代理程式
若要使用 Helm來更新代理程式版本,請完成下列步驟:
-
更新 Helm 儲存庫。
helm repo update -
升級代理程式。
helm upgrade -n ibm-observe sysdig-agent sysdig/sysdig-deploy -f agent-values-monitor-secure.yaml
透過以下步驟,即可將您的代理程式升級至最新可用版本。
移除代理
您也可以使用控制台將代理程式從叢集中移除。 在 IBM Cloud 控制台中,前往「容器」>「叢集」 以存取現有的叢集。 接著,在「Workload Protection」小工具中開啟「選項」選單,並選擇「斷開連線」。
若要透過 Helm 刪除代理程式,請解除安裝該圖表。
-
列出已安裝的圖表。
helm list -n ibm-observe輸出內容列出了已安裝的圖表:
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION sysdig-agent ibm-observe 1 2023-03-24 15:02:58.408108 +0100 CET deployed sysdig-deploy-1.6.3 -
解除安裝圖表。
helm delete sysdig-agent -n ibm-observe在 Helm 中,
sysdig-agent是該版本的名稱。