Les définitions de ressources personnalisées (CRD) sont des outils puissants pour étendre les capacités de Kubernetes.
Toutefois, si une définition de ressource personnalisée contient un bundle d'autorité de certification (AC) non valide ou mal formé dans sa configuration de webhook de conversion spec.conversion.webhook.clientConfig.caBundle, cela peut perturber les opérations du cluster. Cela peut se manifester par des erreurs lors de la création, de la mise à jour ou de la suppression de ressources. Google Kubernetes Engine (GKE) surveille vos clusters et utilise le service de recommandation pour vous fournir des conseils sur la façon d'optimiser votre utilisation de la plate-forme.
Pour vous assurer que votre cluster reste stable et performant, consultez les recommandations de GKE pour les CRD qui fonctionnent, mais dont le bundle d'autorité de certification n'est pas valide. Suivez ces conseils pour vérifier si vos CRD sont potentiellement mal configurées et les mettre à jour, si nécessaire. Pour en savoir plus sur la gestion des insights et des recommandations fournis par les outils de recommandation, consultez la section Optimiser l'utilisation de GKE avec des insights et des recommandations.
Identifier les clusters concernés
Pour obtenir des insights identifiant les clusters concernés par les CRD avec des bundles d'autorité de certification non valides, suivez les instructions pour afficher les insights et les recommandations pour le sous-type K8S_CRD_WITH_INVALID_CA_BUNDLE. Vous pouvez obtenir des insights de différentes manières :
Utilisez la console Google Cloud .
Utilisez la Google Cloud CLI ou l'API Recommender pour filtrer avec le sous-type K8S_CRD_WITH_INVALID_CA_BUNDLE.
GKE génère un insight et une recommandation avec le sous-type K8S_CRD_WITH_INVALID_CA_BUNDLE si le cluster GKE comporte un ou plusieurs CRD signalant une configuration caBundle incorrecte pour la configuration du client de webhook dans spec.conversion.webhook.clientConfig.
Les sections suivantes vous expliquent comment résoudre les problèmes liés aux CRD que GKE a détectés comme potentiellement mal configurés.
Une fois les instructions et les CRD correctement configurés, la recommandation est résolue dans les 24 heures et n'apparaît plus dans la console.
Si moins de 24 heures se sont écoulées depuis que vous avez mis en œuvre les conseils de la recommandation, vous pouvez la marquer comme résolue.
Si vous ne souhaitez pas appliquer la recommandation, vous pouvez l'ignorer.
Identifier les CRD concernées dans un cluster
Affichez les insights et les recommandations pour le sous-type K8S_CRD_WITH_INVALID_CA_BUNDLE, en choisissant un insight à la fois pour résoudre le problème. GKE génère un insight par cluster dont la CRD est défectueuse.
Exécutez la commande suivante pour décrire le service et trouver les CRD avec des bundles CA potentiellement problématiques :
CaBundle : groupe d'autorités de certification associé au webhook de conversion du CRD, le cas échéant. Examinez le résultat. Si la colonne "caBundle" est vide pour un CRD qui utilise un webhook de conversion, cela indique un problème potentiel avec le caBundle.
Recréer la CRD
Pour résoudre cette erreur, recréez le CRD concerné avec un bundle CA valide :
Sauvegardez les ressources personnalisées existantes associées à cette CRD problématique, le cas échéant. Exécutez la commande suivante pour exporter les ressources existantes :
kubectlget<crd-name>-oyaml > backup.yaml
Supprimez le CRD existant :
kubectldeletecrd<crd-name>
Assurez-vous que le champ caBundle de la définition de ressource personnalisée contient un certificat PEM encodé en base64 correctement formé. Pour ce faire, vous pouvez modifier directement la définition de ressource personnalisée ou contacter ses auteurs.
Modifiez la définition YAML de la CRD en mettant à jour le champ spec.conversion.webhook.clientConfig.caBundle avec les données valides du bundle d'autorité de certification. Le résultat doit se présenter sous la forme suivante :
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/01 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/01 (UTC)."],[],[],null,["# Troubleshoot CRDs with an invalid CA bundle\n\n[Autopilot](/kubernetes-engine/docs/concepts/autopilot-overview) [Standard](/kubernetes-engine/docs/concepts/choose-cluster-mode)\n\n*** ** * ** ***\n\n[Custom Resource\nDefinitions](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/)\n(CRDs) are powerful tools for [extending Kubernetes\ncapabilities](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/).\nHowever, if a CRD contains an invalid or malformed Certificate Authority (CA)\nbundle within its conversion webhook configuration\n`spec.conversion.webhook.clientConfig.caBundle`, it can disrupt cluster\noperations. This can manifest as errors during resource creation, updates, or\ndeletions. Google Kubernetes Engine (GKE) monitors your clusters and uses the\nRecommender service to deliver guidance for how you can optimize your usage of\nthe platform.\n\nTo help you ensure that your cluster remains stable and\nperformant, see recommendations from GKE for CRDs that operate but\nhave an invalid CA bundle. Use this guidance to check your potentially misconfigured CRDs and update them, if necessary. To learn more about how to manage insights and recommendations from\nRecommenders, see [Optimize your usage of GKE with insights and\nrecommendations](/kubernetes-engine/docs/how-to/optimize-with-recommenders).\n\nIdentify impacted clusters\n--------------------------\n\nTo get insights identifying clusters that are affected by CRDs with invalid CA bundles, follow\nthe instructions to [view insights and recommendations](/kubernetes-engine/docs/how-to/optimize-with-recommenders#view-insights-recs) for subtype `K8S_CRD_WITH_INVALID_CA_BUNDLE`. You can get insights in\nthe following ways:\n\n- Use the Google Cloud console.\n- Use the Google Cloud CLI, or the Recommender API, filtering with the subtype `K8S_CRD_WITH_INVALID_CA_BUNDLE`.\n\nAfter you identify the CRDs using the insights, follow the instructions to\n[troubleshoot the misconfigured CA bundle](#troubleshoot-crds).\n\nWhen GKE detects misconfigured CRDs\n-----------------------------------\n\nGKE generates an insight and recommendation with the\n`K8S_CRD_WITH_INVALID_CA_BUNDLE` subtype if the GKE cluster has\none or more CRDs reporting a misconfigured `caBundle` for the webhook client\nconfiguration in `spec.conversion.webhook.clientConfig`.\n\nFollow the instructions to [check CRDs with misconfigured CA bundle](#check-invalid-caBundle).\n\nTroubleshoot the detected CRDs\n------------------------------\n\nThe following sections have instructions for you to troubleshoot the CRDs that\nGKE detected as potentially misconfigured.\n\nAfter you implement the instructions and the CRDs are correctly configured, the\nrecommendation is resolved within 24 hours and no longer appears in the console.\nIf it has been less than 24 hours since you've implemented the guidance of the\nrecommendation, you can [mark the recommendation as\nresolved](/kubernetes-engine/docs/how-to/optimize-with-recommenders#resolve-recommendation).\nIf you don't want to implement the recommendation, you can [dismiss\nit](/kubernetes-engine/docs/how-to/optimize-with-recommenders#dismiss-recommendation).\n\n### Identify affected CRDs in a cluster\n\n1. [View insights and\n recommendations](/kubernetes-engine/docs/how-to/optimize-with-recommenders#view-insights-recs) for subtype `K8S_CRD_WITH_INVALID_CA_BUNDLE`,\n choosing one insight at a time to troubleshoot. GKE generates\n one insight per cluster which has a broken CRD.\n\n2. Run the following command to describe the Service to find CRDs with\n potentially problematic CA bundles:\n\n kubectl get crd -o custom-columns=NAME:.metadata.name,CABUNDLE:.spec.conversion.webhook.clientConfig.caBundle\n\n The output includes the following:\n - **Name**: The name of the CRD.\n - **CaBundle**: The CA bundle associated with the CRD's conversion webhook, if present. Examine the output. If the caBundle column is empty for a CRD that you know utilizes a conversion webhook, this signals a potential issue with the caBundle.\n\n### Recreate the CRD\n\nTo resolve this error, recreate the affected CRD with a valid CA bundle:\n\n1. Back up existing custom resources associated with this problematic\n CRD, if you have any. Run the following command to export the existing\n resources:\n\n kubectl get \u003ccrd-name\u003e -o yaml \u003e backup.yaml\n\n2. Delete the existing CRD:\n\n kubectl delete crd \u003ccrd-name\u003e\n\n3. Ensure that the `caBundle` field of the CRD contains a well-formed,\n base-64-encoded PEM certificate. You can do this either by editing the\n CRD directly or by reaching out to its authors.\n\n4. Modify the CRD YAML definition, updating the\n `spec.conversion.webhook.clientConfig.caBundle` field with the valid\n CA bundle data. The result should look something like the following:\n\n spec:\n conversion:\n webhook:\n clientConfig:\n caBundle: \u003cbase64-encoded-ca-bundle\u003e\n\n5. Apply the corrected CRD:\n\n kubectl apply -f \u003ccorrected-crd-file.yaml\u003e\n\n6. Restore your custom resources:\n\n kubectl apply -f backup.yaml\n\nWhat's next\n-----------\n\n- [Optimize your usage of GKE with insights and\n recommendations](/kubernetes-engine/docs/how-to/optimize-with-recommenders)\n- [Troubleshooting common issues](/kubernetes-engine/docs/troubleshooting)"]]