トラブルシューティング

Red Hat Advanced Cluster Management for Kubernetes 2.0

トラブルシューティング

概要

Red Hat Advanced Cluster Management for Kubernetes でのトラブルシューティング

第1章 トラブルシューティング

トラブルシューティングガイドをご使用の前に oc adm must-gather コマンドを実行して、詳細、ログを収集し、問題のデバッグ手順を行います。

また、ロールベースのアクセス権限を確認してください。詳細は、「ロールベースアクセス制御機能」を参照してください。

1.1. Must-gather

はじめに、問題のデバッグを行う must-gather コマンドを実行する場合のトラブルシューティングシナリオについて説明します。

  • シナリオ 1: 文書化されたトラブルシューティング セクションを使用して、問題の解決策がまとめられているかどうかを確認します。本ガイドは、製品の主な機能別に構成されています。

    このシナリオでは、解決策が本書にまとめられているかどうかを、本ガイドで確認します。たとえば、クラスターの作成に関するトラブルシューティングの場合は、クラスターの管理 セクションの解決策を探します。

  • シナリオ 2: 問題の解決策の手順が文書にまとめられていない場合は、must-gather コマンドを実行し、その出力を使用して問題をデバッグします。
  • シナリオ 3: must-gather コマンドの出力を使用して問題をデバッグできない場合は、Red Hat サポートに、出力を共有します。

must-gather コマンドの使用を開始するには、以下の手順を参照してください。

  1. must-gather コマンドについて確認し、「Red Hat サポート用のクラスターについてのデータの収集」に必要な前提条件をインストールします。
  2. コンソールにログインします。通常のユースケースでは、ハブ クラスターにログインして、must-gather を実行する必要があります。

    注記: マネージドクラスターを確認する場合には、cluster-scoped-resources ディレクトリーにある gather-spoke.log ファイルを検索します。

    <your-directory>/cluster-scoped-resources/gather-spoke.log>

    JOINED および AVAILABLE 列に True が設定されていないマネージドクラスター (スポーククラスター) がないかを確認します。must-gather コマンドは、ステータスが True として関連付けられていないクラスター上で、実行できます。

  3. データおよびディレクトリーの収集に使用する Red Hat Advanced Cluster Management for Kubernetes イメージを追加します。以下のコマンドを実行して、出力用にイメージとディレクトリーを挿入します。

    oc adm must-gather --image=registry.redhat.io/rhacm2/acm-must-gather-rhel8:v2.0.0 --dest-dir=<directory>
  4. 指定したディレクトリーに移動し、以下のレベルに整理されている出力を確認します。

    • ピアレベル 2 つ: cluster-scoped-resourcesnamespace のリソース
    • それぞれに対するサブレベル: クラスタースコープおよび namespace スコープの両方のリソースに対するカスタムリソース定義の API グループ。
    • それぞれの次のレベル: kind でソートされた YAML ファイル

1.2. 文書化されたトラブルシューティング

以下に、Red Hat Advanced Cluster Management for Kubernetes のトラブルシューティングのトピックリストを表示します。

インストールシステム

元のインストールタスクに戻るには、インストール を参照してください。

クラスター管理

元のクラスター管理タスクを表示するには、『クラスターの管理』を参照してください。

アプリケーション管理

元のアプリケーション管理タスクを表示するには、『アプリケーションの管理』を参照してください。

ガバナンスおよびリスク

元のセキュリティーガイドを表示するには、「セキュリティー」を参照してください。

コンソールの可観測性

コンソールの可観測性には、ヘッダーおよびナビゲーション機能、検索機能および Visual Web ターミナルが含まれます。元の可観測性ガイドを表示するには、「コンソールの可観測性」を参照してください。

1.3. 再インストールに失敗する場合のトラブルシューティング

Red Hat Advanced Cluster Management for Kubernetes を再インストールすると Pod が起動しません。

1.3.1. 現象: 再インストールの失敗

Red Hat Advanced Cluster Management for Kubernetes のインストール後に Pod が起動しない場合には、Red Hat Advanced Cluster Management 以前にインストールされており、今回のインストールを試行する前にすべてのパーツが削除されていない可能性があります。

Pod はこのような場合に、インストールプロセスの完了後に起動しません。

1.3.2. 問題の解決: 再インストールの失敗

この問題が発生した場合は、以下の手順を実行します。

  1. アンインストール の手順に従い、現在のコンポーネントを削除し、アンインストールプロセスを実行します。
  2. Installing Helm の手順に従い、Helm CLI バイナリーバージョン 3.2.0 以降をインストールします。
  3. oc コマンドが実行できるように、Red Hat OpenShift Container Platform CLI が設定されていることを確認してください。oc コマンドの設定方法に関する詳細は、Red Hat OpenShift ドキュメントの「CLI の使用方法」を参照してください。
  4. 以下のスクリプトをファイルにコピーします。

    #!/bin/bash
    ACM_NAMESPACE=<namespace>
    oc delete mch --all -n $ACM_NAMESPACE
    helm ls --namespace $ACM_NAMESPACE | cut -f 1 | tail -n +2 | xargs -n 1 helm delete --namespace $ACM_NAMESPACE
    oc delete apiservice v1.admission.cluster.open-cluster-management.io v1beta1.webhook.certmanager.k8s.io
    oc delete clusterimageset --all
    oc delete configmap -n $ACM_NAMESPACE cert-manager-controller cert-manager-cainjector-leader-election cert-manager-cainjector-leader-election-core
    oc delete consolelink acm-console-link
    oc delete crd klusterletaddonconfigs.agent.open-cluster-management.io placementbindings.policy.open-cluster-management.io policies.policy.open-cluster-management.io userpreferences.console.open-cluster-management.io searchservices.search.acm.com
    oc delete mutatingwebhookconfiguration cert-manager-webhook
    oc delete oauthclient multicloudingress
    oc delete rolebinding -n kube-system cert-manager-webhook-webhook-authentication-reader
    oc delete scc kui-proxy-scc
    oc delete validatingwebhookconfiguration cert-manager-webhook

    スクリプトの <namespace> は、Red Hat Advanced Cluster Management がインストールされている namespace 名に置き換えます。namespace が消去され削除されるため、正しい namespace を指定するようにしてください。

  5. スクリプトを実行して、アーティファクトを以前のインストールから削除します。
  6. インストールを実行します。「ネットワーク接続時のオンラインインストール」を参照してください。

1.4. リソースが存在しないためにアンインストールに失敗する場合のトラブルシューティング

1.4.1. 現象: リソースが存在しないためにアンインストールに失敗する

Red Hat Advanced Cluster Management for Kubernetes をアンインストールすると、以下のエラーメッセージで、インストールに失敗します。

Cannot delete MultiClusterHub resource because ManagedCluster resource(s) exist

1.4.2. 問題の解決: リソースが存在しないためにアンインストールに失敗する

このエラーは、Red Hat Advanced Cluster Management ハブクラスターでまだクラスターが管理されているにも拘らず、ハブクラスターをアンインストールしようとすると発生します。ハブクラスターをアンインストールする前に、すべてのクラスターを管理下から削除する必要があります。

ハブクラスターが管理しているクラスターをすべてデタッチし、再度アンインストールを試みます。

クラスターのデタッチの詳細は、「Red Hat Advanced Cluster Management for Kubernetes でのクラスターの作成」でお使いのプロバイダーの情報を選択して、「マネージメントからのクラスターの削除」セクションを参照してください。

1.5. オフラインクラスターのトラブルシューティング

クラスターのステータスがオフラインと表示される一般的な原因がいくつかあります。

1.5.1. 現象: クラスターのステータスがオフライン状態である

クラスターの作成手順を完了したら、Red Hat Advanced Cluster Management コンソールからアクセスできず、クラスターのステータスが offline と表示されます。

1.5.2. 問題の解決: クラスターのステータスがオフライン状態になっている

  1. マネージドクラスターが利用可能かどうかを確認します。これは、Red Hat Advanced Cluster Management コンソールの Clusters エリアで確認できます。

    利用不可の場合は、マネージドクラスターの再起動を試行します。

  2. マネージドクラスターのステータスがオフラインのままの場合は、以下の手順を実行します。

    1. ハブクラスターで oc get managedcluster <cluster_name> -o yaml コマンドを実行します。<cluster_name> は、クラスター名に置き換えます。
    2. status.conditions セクションを見つけます。
    3. type: ManagedClusterConditionAvailable のメッセージを確認して、問題を解決します。

1.6. アップグレード後の失敗したインポート済みクラスターシークレットのトラブルシューティング

1.6.1. 現象: アップグレード後の失敗したインポート済みクラスターシークレットのトラブルシューティング

Red Hat Advanced Cluster Management for Kubernetes バージョン 2.0.0 からバージョン 2.0.1 へのアップグレード後、Red Hat Advanced Cluster Management コンソールでのクラスターのインポートは以下のメッセージで失敗する可能性があります。

Failed to fetch import yaml secret

1.6.2. 問題の特定: アップグレード後の失敗したインポート済みクラスターシークレットのトラブルシューティング

以下の手順で問題を解決できることを確認するには、以下の手順を実行します。

  1. 以下のコマンドを実行して、Red Hat Advanced Cluster Management インストール namespace に変更します。

    oc project <namespace>

    <namespace> は、Red Hat Advanced Cluster Management インストールの namespace に置き換えます。デフォルト値を使用した場合は、open-cluster-management になります。

  2. 以下のコマンドを実行して、managedcluster-import-controller に必要なパーミッションがあるかどうかを確認します。

    oc get $(oc get clusterrole -o name | grep managedcluster-import-controller) -o yaml| grep apiservers

    コマンドが空の応答を返す場合は、問題の解決 セクションの手順を実行して問題を修正します。

1.6.3. 問題の解決: アップグレード後の失敗したインポート済みクラスターシークレットのトラブルシューティング

この問題を解決するには、以下のコマンドを実行して multicluster-operators-standalone-subscription サービスを再起動します。

oc delete $(oc get pod -o name | grep multicluster-operators-standalone-subscription)

1.7. Pending Import ステータスのクラスターのトラブルシューティング

クラスターのコンソールで継続的に Pending import と表示される場合は、以下の手順を実行して問題をトラブルシューティングしてください。

1.7.1. 現象: ステータスが Pending Import クラスター

Red Hat Advanced Cluster Management コンソールを使用してクラスターをインポートした後に、コンソールで、クラスターのステータスが Pending import と表示されます。

1.7.2. 問題の特定: ステータスが Pending Import クラスター

  1. マネージドクラスターで以下のコマンドを実行し、問題のある Kubernetes Pod 名を表示します。

    kubectl get pod -n open-cluster-management-agent | grep klusterlet-registration-agent
  2. マネージドクラスターで以下のコマンドを実行し、エラーのログエントリーを探します。

    kubectl logs <registration_agent_pod>

    registration_agent_pod は、手順 1 で特定した Pod 名に置き換えます。

  3. 返された結果に、ネットワーク接続の問題があったと示すテキストがないかどうかを検索します。たとえば、no such host です。

1.7.3. 問題の解決: ステータスが Pending Import クラスター

  1. ハブクラスターで以下のコマンドを実行して、問題のあるポート番号を取得します。

    oc get infrastructure cluster -o yaml | grep apiServerURL
  2. マネージドクラスターのホスト名が解決でき、ホストおよびポートへの送信接続が機能していることを確認します。

    マネージドクラスターで通信が確立できない場合は、クラスターのインポートが完了していません。マネージドクラスターのクラスターステータスは、Pending import になります。

1.8. 証明書を変更した後のすべてのインポート済みクラスターのオフラインでのトラブルシューティング

カスタムの apiserver 証明書のインストールはサポートされますが、証明書情報を変更する前にインポートされたすべてのクラスターは、ステータスが オフライン になる可能性があります。

1.8.1. 現象: 証明書の変更後にすべてのクラスターがオフラインになる

証明書シークレットの更新手順を完了すると、オンラインになっていたすべてのクラスターが、Red Hat Advanced Cluster Management for Kubernetes コンソールで offline ステータスと表示されます。

1.8.2. 問題の特定: 証明書の変更後にすべてのクラスターがオフラインになる

カスタムの API サーバー証明書の情報を更新すると、インポートされ、新しい証明書が追加される前に稼働していたクラスターのステータスが offline になります。

オフラインのマネージドクラスターの open-cluster-management-agent namespace にある Pod のログで、証明書に問題があるとのエラーが見つかります。以下の例のようなエラーがログに表示されます。

work-agent のログ:

E0917 03:04:05.874759       1 manifestwork_controller.go:179] Reconcile work test-1-klusterlet-addon-workmgr fails with err: Failed to update work status with err Get "https://api.aaa-ocp.dev02.location.com:6443/apis/cluster.management.io/v1/namespaces/test-1/manifestworks/test-1-klusterlet-addon-workmgr": x509: certificate signed by unknown authority
E0917 03:04:05.874887       1 base_controller.go:231] "ManifestWorkAgent" controller failed to sync "test-1-klusterlet-addon-workmgr", err: Failed to update work status with err Get "api.aaa-ocp.dev02.location.com:6443/apis/cluster.management.io/v1/namespaces/test-1/manifestworks/test-1-klusterlet-addon-workmgr": x509: certificate signed by unknown authority
E0917 03:04:37.245859       1 reflector.go:127] k8s.io/client-go@v0.19.0/tools/cache/reflector.go:156: Failed to watch *v1.ManifestWork: failed to list *v1.ManifestWork: Get "api.aaa-ocp.dev02.location.com:6443/apis/cluster.management.io/v1/namespaces/test-1/manifestworks?resourceVersion=607424": x509: certificate signed by unknown authority

registration-agent のログ:

I0917 02:27:41.525026       1 event.go:282] Event(v1.ObjectReference{Kind:"Namespace", Namespace:"open-cluster-management-agent", Name:"open-cluster-management-agent", UID:"", APIVersion:"v1", ResourceVersion:"", FieldPath:""}): type: 'Normal' reason: 'ManagedClusterAvailableConditionUpdated' update managed cluster "test-1" available condition to "True", due to "Managed cluster is available"
E0917 02:58:26.315984       1 reflector.go:127] k8s.io/client-go@v0.19.0/tools/cache/reflector.go:156: Failed to watch *v1beta1.CertificateSigningRequest: Get "https://api.aaa-ocp.dev02.location.com:6443/apis/cluster.management.io/v1/managedclusters?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dtest-1&resourceVersion=607408&timeout=9m33s&timeoutSeconds=573&watch=true"": x509: certificate signed by unknown authority
E0917 02:58:26.598343       1 reflector.go:127] k8s.io/client-go@v0.19.0/tools/cache/reflector.go:156: Failed to watch *v1.ManagedCluster: Get "https://api.aaa-ocp.dev02.location.com:6443/apis/cluster.management.io/v1/managedclusters?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dtest-1&resourceVersion=607408&timeout=9m33s&timeoutSeconds=573&watch=true": x509: certificate signed by unknown authority
E0917 02:58:27.613963       1 reflector.go:127] k8s.io/client-go@v0.19.0/tools/cache/reflector.go:156: Failed to watch *v1.ManagedCluster: failed to list *v1.ManagedCluster: Get "https://api.aaa-ocp.dev02.location.com:6443/apis/cluster.management.io/v1/managedclusters?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dtest-1&resourceVersion=607408&timeout=9m33s&timeoutSeconds=573&watch=true"": x509: certificate signed by unknown authority

1.8.3. 問題の解決: 証明書の変更後にすべてのクラスターがオフラインになる

証明書情報の更新後にクラスターを手動で復元するには、各マネージドクラスターで以下の手順を実行します。

  1. もう一度、クラスターを手動でインポートします。Red Hat Advanced Cluster Management で作成された Red Hat OpenShift Container Platform クラスターは 2 時間ごとに再同期されるので、これらのクラスターについてはこの手順を省略できます。

    1. ハブクラスターで、以下のコマンドを入力してインポートコマンドを表示します。

      oc get secret -n ${CLUSTER_NAME} ${CLUSTER_NAME}-import -ojsonpath='{.data.import\.yaml}' | base64 --decode  > import.yaml

      CLUSTER_NAME は、インポートするマネージドクラスターの名前に置き換えます。

    2. マネージドクラスターで、import.yaml ファイルを適用します。

      oc apply -f import.yaml
  2. マネージドクラスターで古いシークレットを削除して、registration-agent が最新のブートストラップシークレットを使用してシークレットを再作成していることを確認します。

    oc delete secret hub-kubeconfig-secret -n open-cluster-management-agent
  3. open-cluster-management-agent namespace のすべての Pod を再起動します。

    oc delete po —all -n open-cluster-management-agent
  4. クラスターが接続し、work-manager が起動するまで 2 - 3 分待機します。
  5. open-cluster-management-agent-addon namespace ですべての Pod を再起動します。

    oc delete po —all -n open-cluster-management-agent-addon

    Pod は停止し、再起動時に新規の証明書情報を使用します。

1.9. ステータスが Pending または Failed のクラスターのコンソールでのトラブルシューティング

作成してたクラスターのステータスがコンソールで Pending または Failed と表示されている場合は、以下の手順を実行して問題のトラブルシューティングを実行します。

1.9.1. 現象: コンソールでステータスが Pending または Failed のクラスターのトラブルシューティング

Red Hat Advanced Cluster Management for Kubernetes コンソールで新規クラスターを作成した後に、コンソールでクラスターのステータスが Pending または Failed と表示されてそれ以上進みません。

1.9.2. 問題の特定: コンソールでステータスが Pending または Failed のクラスター

クラスターのステータスが Failed と表示される場合は、クラスターの詳細ページに移動して、提供されたログへのリンクに進みます。ログが見つからない場合や、クラスターのステータスが Pending と表示される場合は、以下の手順を実行してログを確認します。

  • 手順 1

    1. ハブクラスターで以下のコマンドを実行し、新規クラスターの namespace に作成した Kubernetes Pod の名前を表示します。

      oc get pod -n <new_cluster_name>

      new_cluster_name は、作成したクラスター名に置き換えます。

    2. 名前に provision の文字列が含まれる Pod が表示されていない場合は、手順 2 に進みます。タイトルに provision が含まれる Pod があった場合は、ハブクラスターで以下のコマンドを実行して、その Pod のログを表示します。

      oc logs <new_cluster_name_provision_pod_name> -n <new_cluster_name> -c hive

      new_cluster_name_provision_pod_name は、作成したクラスター名の後に provision が含まれる Pod 名を指定するように置き換えます。

    3. ログでエラーを検索してください。この問題の原因が解明する場合があります。
  • 手順 2

    名前に provision が含まれる Pod がない場合は、問題がプロセスの初期段階で発生しています。ログを表示するには、以下の手順を実行します。

    1. ハブクラスターで以下のコマンドを実行してください。

      oc describe clusterdeployments -n <new_cluster_name>

      new_cluster_name は、作成したクラスター名に置き換えます。クラスターのインストールログの詳細は、Red Hat OpenShift ドキュメントの インストールログの収集 を参照してください。

    2. リソースの Status.Conditions.MessageStatus.Conditions.Reason のエントリーに問題に関する追加の情報があるかどうかを確認します。

1.9.3. 問題の解決: コンソールでステータスが Pending または Failed のクラスター

ログでエラーを特定した後に、エラーの解決方法を決定してから、クラスターを破棄して、作り直してください。

以下の例では、サポート対象外のゾーンを選択している可能性を示すログエラーと、解決に必要なアクションが提示されています。

No subnets provided for zones

クラスターの作成時に、サポートされていないリージョンにあるゾーンを 1 つ以上選択しています。問題解決用にクラスターを再作成する時に、以下のアクションの 1 つを実行します。

  • リージョン内の異なるゾーンを選択します。
  • 他のゾーンをリストしている場合は、サポートを提供しないゾーンを省略します。
  • お使いのクラスターに、別のリージョンを選択します。

ログから問題を特定した後に、クラスターを破棄し、再作成します。

クラスターの作成に関する詳細は、「Red Hat Advanced Cluster Management for Kubernetes でのクラスターの作成」を参照してください。

1.10. OpenShift Container Platform バージョン 3.11 クラスターのインポートの失敗時のトラブルシューティング

1.10.1. 現象: OpenShift Container Platform バージョン 3.11 クラスターのインポートに失敗する

Red Hat OpenShift Container Platform バージョン 3.11 クラスターのインポートを試行すると、以下の内容のようなログメッセージでインポートに失敗します。

customresourcedefinition.apiextensions.k8s.io/klusterlets.operator.open-cluster-management.io configured
clusterrole.rbac.authorization.k8s.io/klusterlet configured
clusterrole.rbac.authorization.k8s.io/open-cluster-management:klusterlet-admin-aggregate-clusterrole configured
clusterrolebinding.rbac.authorization.k8s.io/klusterlet configured
namespace/open-cluster-management-agent configured
secret/open-cluster-management-image-pull-credentials unchanged
serviceaccount/klusterlet configured
deployment.apps/klusterlet unchanged
klusterlet.operator.open-cluster-management.io/klusterlet configured
Error from server (BadRequest): error when creating "STDIN": Secret in version "v1" cannot be handled as a Secret:
v1.Secret.ObjectMeta:
v1.ObjectMeta.TypeMeta: Kind: Data: decode base64: illegal base64 data at input byte 1313, error found in #10 byte of ...|dhruy45="},"kind":"|..., bigger context ...|tye56u56u568yuo7i67i67i67o556574i"},"kind":"Secret","metadata":{"annotations":{"kube|...

1.10.2. 問題の特定: OpenShift Container Platform バージョン 3.11 クラスターのインポートに失敗する

この問題は多くの場合、インストールされている kubectl コマンドラインツールのバージョンが 1.11 以前であるために発生します。以下のコマンドを実行して、実行中の kubectl コマンドラインツールのバージョンを表示します。

kubectl version

返されたデータがバージョンが 1.11 以前の場合は、問題の解決: OpenShift Container Platform バージョン 3.11 クラスターのインポートに失敗する に記載される修正のいずれかを実行します。

1.10.3. 問題の解決: OpenShift Container Platform バージョン 3.11 クラスターのインポートに失敗する

この問題は、以下のいずれかの手順を実行して解決できます。

  • 最新バージョンの kubectl コマンドラインツールをインストールします。

    1. Kubernetes ドキュメントの Install and Set Up kubectl から最新バージョンの kubectl ツールをダウンロードします。
    2. kubectl ツールのアップグレード後にクラスターを再度インポートします。
  • import コマンドが含まれるファイルを実行します。

    1. CLI を使用したマネージドクラスターのインポート」の手順を開始します。
    2. クラスターのインポートコマンドを作成する場合には、このインポートコマンドを import.yaml という名前の YAML ファイルにコピーします。
    3. 以下のコマンドを実行して、ファイルからクラスターを再度インポートします。

      oc apply -f import.yaml

1.11. アプリケーションの Kubernetes デプロイメントバージョンのトラブルシューティング

非推奨の Kubernetes apiVersion を使用するマネージドクラスターはサポートされない可能性があります。非推奨の API バージョンの詳細は、Kubernetes issue を参照してください。

1.11.1. 現象: アプリケーションデプロイメントバージョン

サブスクリプションの YAML ファイルのアプリケーションリソースの 1 つまたは複数で、非推奨の API が使用されている場合に、以下のようなエラーが発生する可能性があります。

failed to install release: unable to build kubernetes objects from release manifest: unable to recognize "": no matches for
kind "Deployment" in version "extensions/v1beta1"

または、old.yaml などの名前で YAML ファイルに新しい Kubernetes API バージョンを追加している場合は、以下のエラーが発生する可能性があります。

error: unable to recognize "old.yaml": no matches for kind "Deployment" in version "deployment/v1beta1"

1.11.2. 解決: アプリケーションデプロイメントバージョン

  1. リソースの apiVersion を更新します。たとえば、サブスクリプション YAML ファイルの Deployment の種類のエラーが表示された場合は、apiVersionextensions/v1beta1 から apps/v1 に更新する必要があります。

    以下の例を参照してください。

    apiVersion: apps/v1
    kind: Deployment
  2. マネージドクラスターで以下のコマンドを実行して、利用可能なバージョンを確認します。

    kubectl explain <resource>
  3. VERSION を確認します。

1.12. 検索コレクター Pod のトラブルシューティング

search-collector がクラッシュし、CrashLoopback ステータスが表示されます。