Le definizioni di risorse personalizzate (CRD) sono strumenti potenti per estendere le funzionalità di Kubernetes.
Tuttavia, se una CRD contiene un bundle di autorità di certificazione (CA) non valido o malformato all'interno della configurazione del webhook di conversione
spec.conversion.webhook.clientConfig.caBundle, può interrompere le operazioni del cluster. Ciò può manifestarsi come errori durante la creazione, gli aggiornamenti o le eliminazioni delle risorse. Google Kubernetes Engine (GKE) monitora i cluster e utilizza il servizio Recommender per fornire indicazioni su come ottimizzare l'utilizzo della piattaforma.
Per aiutarti a garantire che il tuo cluster rimanga stabile e
performante, consulta i suggerimenti di GKE per le CRD che funzionano ma
hanno un bundle CA non valido. Utilizza queste indicazioni per controllare le CRD potenzialmente configurate in modo errato e aggiornarle, se necessario. Per saperne di più su come gestire approfondimenti e suggerimenti di Recommenders, consulta Ottimizzare l'utilizzo di GKE con approfondimenti e suggerimenti.
Identificare i cluster interessati
Per ottenere approfondimenti che identificano i cluster interessati dalle CRD con bundle CA non validi, segui
le istruzioni per visualizzare approfondimenti e consigli per il sottotipo K8S_CRD_WITH_INVALID_CA_BUNDLE. Puoi ottenere approfondimenti nei seguenti modi:
Utilizza la console Google Cloud .
Utilizza Google Cloud CLI o l'API Recommender, filtrando con il sottotipo
K8S_CRD_WITH_INVALID_CA_BUNDLE.
GKE genera un approfondimento e un consiglio con il sottotipo K8S_CRD_WITH_INVALID_CA_BUNDLE se il cluster GKE ha uno o più CRD che segnalano un caBundle configurato in modo errato per la configurazione del client webhook in spec.conversion.webhook.clientConfig.
Le sezioni seguenti contengono istruzioni per risolvere i problemi relativi alle CRD che
GKE ha rilevato come potenzialmente configurate in modo errato.
Dopo aver implementato le istruzioni e configurato correttamente i CRD, il
suggerimento viene risolto entro 24 ore e non viene più visualizzato nella console.
Se sono trascorse meno di 24 ore dall'implementazione delle indicazioni del consiglio, puoi contrassegnare il consiglio come risolto.
Se non vuoi implementare il suggerimento, puoi ignorarlo.
Identificare le CRD interessate in un cluster
Visualizza approfondimenti e
consigli per il sottotipo K8S_CRD_WITH_INVALID_CA_BUNDLE,
scegliendo un approfondimento alla volta per la risoluzione dei problemi. GKE genera
un approfondimento per cluster con una CRD danneggiata.
Esegui questo comando per descrivere il servizio e trovare CRD con bundle CA potenzialmente problematici:
CaBundle: il bundle CA associato al webhook di conversione del CRD, se presente. Esamina l'output. Se la colonna caBundle è vuota
per un CRD che sai che utilizza un webhook di conversione, ciò indica un
potenziale problema con caBundle.
Ricrea la CRD
Per risolvere questo errore, ricrea il CRD interessato con un bundle CA valido:
Esegui il backup delle risorse personalizzate esistenti associate a questo CRD problematico, se presenti. Esegui questo comando per esportare le risorse esistenti:
kubectlget<crd-name>-oyaml > backup.yaml
Elimina la CRD esistente:
kubectldeletecrd<crd-name>
Assicurati che il campo caBundle della CRD contenga un certificato PEM con codifica Base64 in formato corretto. Puoi farlo modificando direttamente la CRD o contattando i relativi autori.
Modifica la definizione YAML del CRD, aggiornando il
campo spec.conversion.webhook.clientConfig.caBundle con i dati del
bundle CA validi. Il risultato dovrebbe essere simile al seguente:
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 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)"]]