如何排除機密容器的故障?
檢視這些可能的問題。
這些問題可能是由於設定時的錯誤設定所造成。
若要開始疑難排解,請執行下列指令,盡可能收集有關機密容器的資料。
-
收集有關操作員的資訊。
oc get csv -n openshift-sandboxed-containers-operatoroc describe csv -n openshift-sandboxed-containers-operatoroc get all -n openshift-sandboxed-containers-operator -
從所有與 DaemonSets 相關的 Pod 擷取日誌和事件。
oc describe pod/osc-caa-ds-<random string> -n openshift-sandboxed-containers-operatoroc logs pod/osc-caa-ds-<random string> -n openshift-sandboxed-containers-operatoroc describe pod/osc-config-sync-install-<random string> -n openshift-sandboxed-containers-operatoroc logs pod/osc-config-sync-install-<random string> -n openshift-sandboxed-containers-operatoroc describe pod/osc-rpm-install-<random string> -n openshift-sandboxed-containers-operatoroc logs pod/osc-rpm-install-<random string> -n openshift-sandboxed-containers-operator -
收集豆莢相關資訊。
a. 收集有關控制器管理員的資訊。
oc describe pod/controller-manager-<random string> -n openshift-sandboxed-containers-operatoroc logs pod/controller-manager-<random string> -n openshift-sandboxed-containers-operatorb. 針對一個隨機字串收集日誌。
oc logs pod/<random string>oc describe pod/<random string>c. 收集有關
openshift-sandboxed-containers-operator-bundle的資訊。oc logs pod/trikprot-openshift-sandboxed-containers-operator-bundle-<version>oc describe pod/trikprot-openshift-sandboxed-containers-operator-bundle-<version> -
收集有關 ConfigMaps 的資訊。
a. 收集功能閘道的相關資訊。
oc get configmap/osc-feature-gates -n openshift-sandboxed-containers-operator -o yamlb. 收集對等 pod 的相關資訊。
oc get configmap/peer-pods-cm -n openshift-sandboxed-containers-operator -o yamlc. 收集有關秘密的資訊。
oc get secret/auth-json-secret -n openshift-sandboxed-containers-operatoroc get secret/peer-pods-secret -n openshift-sandboxed-containers-operatord. 收集有關 KataConfig 的資訊。
oc get kataconfigs.kataconfiguration.openshift.io/kata-runtime-settings -n openshift-sandboxed-containers-operator -o yamle. 收集有關自訂資源定義的資訊。
oc get crd/peerpods.confidentialcontainers.orgoc get crd/kataconfigs.kataconfiguration.openshift.io -
檢查對等 pod 的容量和限制。
a. 檢查所有 Worker 節點目前的對等 Pod 限制。
oc get nodes -o json | jq -r '[.items[] | select (.status.allocatable["kata.peerpods.io/vm"] != null)| .status.allocatable["kata.peerpods.io/vm"] | tonumber] | add'b. 檢查每個 Worker 節點上已分配的資源。
for n in $(oc get nodes -o name); do echo "=== $n ===" oc describe "$n" | sed -n '/Allocated resources:/,/Events:/p' donec. 計算目前正在執行的對等 Pod 數量。
oc get pods -A -o json | jq '.items[] | select(.spec.runtimeClassName == "kata-remote") | "\(.metadata.namespace)/\(.metadata.name)"' | wc -l
常見問題與解決方案
kata.peerpods.io/vm 錯誤不足
如果您在排程對等 Pod 時看到類似以下的錯誤:
Warning FailedScheduling 0/30 nodes are available: 9 Insufficient kata.peerpods.io/vm. preemption: 0/30 nodes are available: 9 No preemption victims found for incoming pod.
此錯誤表示您的工作節點已達到 PEERPODS_LIMIT_PER_NODE 限制。 預設限制是每個 Worker 節點有 10 個對等 Pod。
如需解決這個問題,請採取下列動作:
-
驗證目前的限制以及有多少對等 Pod 正在執行。
oc get nodes -o json | jq '.items[] | {name: .metadata.name, allocatable: .status.allocatable["kata.peerpods.io/vm"], capacity: .status.capacity["kata.peerpods.io/vm"]}' -
增加
peer-pods-cmConfigMap 中的PEERPODS_LIMIT_PER_NODE值。 如需詳細資訊,請參閱 建立機密容器。oc -n openshift-sandboxed-containers-operator patch cm peer-pods-cm \ --type merge \ -p '{"data":{"PEERPODS_LIMIT_PER_NODE":"24"}}' -
重新啟動 Cloud API Adapter daemonset。
oc -n openshift-sandboxed-containers-operator rollout restart daemonset/osc-caa-ds -
確認新的限制已套用。
oc get nodes -o json | jq -r '[.items[] | select (.status.allocatable["kata.peerpods.io/vm"] != null)| .status.allocatable["kata.peerpods.io/vm"] | tonumber] | add'
如需對等 Pod 限制和容量規劃的詳細資訊,請參閱 每個 Worker 節點可以執行多少個對等 Pod?
升級至 OSC Operator 後發生 IAM 驗證錯誤 1.12.1
若您在升級至 OpenShift 沙箱容器操作員版本後,於雲端 API 轉接器(CAA)日誌中看到類似以下內容的錯誤訊息:1.12.1:
cloud-api-adaptor: cluster error with:
Unauthorized
further details:
{
"StatusCode": 401,
"Result": {
"code": "A0007",
"description": "You do not have the correct permissions to perform this action..."
}
}
1.12.1 版本引入了一項新要求,即需從 IBM Cloud 的 IKS 叢集服務 API 自動擷取叢集的安全群組。 當您使用「IBMCLOUD_IAM_PROFILE_ID」進行身分驗證(運算資源身分)時,IAM 配置檔可能缺乏查詢叢集服務 API 所需的權限。
請從以下選項中選擇一項。
- 授予額外的 IAM 權限(建議)
-
更新 IAM 配置檔,以包含 IKS 叢集服務 API 的權限,具體而言是能夠呼叫
GetClusterTypeSecurityGroups()的權限。 請聯絡您的 IBM Cloud 管理員,以新增所需的權限。 - 明確設定安全群組 ID
-
請在
peer-pods-cmConfigMap 中設定IBMCLOUD_VPC_SG_ID環境變數,以繞過自動叢集安全群組查詢。 接著重新啟動 Cloud API Adapter 的 daemonset。- 請將您的安全群組 ID 填入 ConfigMap 中。
oc -n openshift-sandboxed-containers-operator patch cm peer-pods-cm \ --type merge \ -p '{"data":{"IBMCLOUD_VPC_SG_ID":"<your-security-group-id>"}}' ``` 2. 重新啟動 Cloud API Adapter daemonset。 ```sh {: pre} oc -n openshift-sandboxed-containers-operator rollout restart daemonset/osc-caa-ds ``` - 切換至 API 金鑰驗證
-
將驗證方式從「
IBMCLOUD_IAM_PROFILE_ID」切換為「IBMCLOUD_API_KEY」。 API 金鑰驗證使用附帶明確 IAM 政策的服务 ID,您可以將其範圍設定為包含所需的叢集服務權限。 請將peer-pods-secret中的機密值更新為您的 API 金鑰,而非 IAM 配置檔 ID。
有關此項變更的更多資訊,請參閱 上游 cloud-api-adaptor 提交 dde66055。
CPU 不足錯誤
如果您在排程對等 Pod 時看到類似以下的錯誤:
Warning FailedScheduling 0/3 nodes are available: 3 Insufficient cpu. preemption: 0/3 nodes are available: 3 No preemption victims found for incoming pod.
此錯誤表示您的工作節點沒有足夠的可用 CPU 資源。 每個對等 pod 會消耗工作節點上約 250m CPU,用於 Kubernetes pod 建構,即使實際工作負載在單獨的 VSI 中執行。
如需解決這個問題,請採取下列動作:
-
檢查工作節點上的 CPU 分配。
for n in $(oc get nodes -o name); do echo "=== $n ===" oc describe "$n" | sed -n '/Allocated resources:/,/Events:/p' done -
選擇下列其中一個選項:
- 在您的叢集中新增更多工作節點
- 使用具有更多 vCPUs
- 減少
PEERPODS_LIMIT_PER_NODE值,以符合您的工作站節點容量 - 從工作節點移除其他工作負載,以釋放 CPU 資源