Custom Resource
Definitions
(CRD) adalah alat canggih untuk memperluas kemampuan Kubernetes.
Namun, jika CRD berisi paket Certificate Authority (CA) yang tidak valid atau salah format dalam konfigurasi webhook konversinya spec.conversion.webhook.clientConfig.caBundle, hal ini dapat mengganggu operasi cluster. Hal ini dapat menyebabkan error selama pembuatan, pembaruan, atau penghapusan resource. Google Kubernetes Engine (GKE) memantau cluster Anda dan menggunakan layanan Pemberi rekomendasi untuk memberikan panduan tentang cara mengoptimalkan penggunaan platform.
Untuk membantu memastikan cluster Anda tetap stabil dan
memiliki performa tinggi, lihat rekomendasi dari GKE untuk CRD yang beroperasi, tetapi
memiliki CA bundle yang tidak valid. Gunakan panduan ini untuk memeriksa CRD yang berpotensi salah dikonfigurasi dan memperbaruinya jika perlu. Untuk mempelajari lebih lanjut cara mengelola insight dan rekomendasi dari
Pemberi Rekomendasi, lihat Mengoptimalkan penggunaan GKE dengan insight dan
rekomendasi.
Mengidentifikasi cluster yang terpengaruh
Untuk mendapatkan insight yang mengidentifikasi cluster yang terpengaruh oleh CRD dengan paket CA yang tidak valid, ikuti petunjuk untuk melihat insight dan rekomendasi untuk subjenis K8S_CRD_WITH_INVALID_CA_BUNDLE. Anda bisa mendapatkan insight dengan cara berikut:
Gunakan Google Cloud console.
Gunakan Google Cloud CLI atau Recommender API, dengan memfilter subjenis
K8S_CRD_WITH_INVALID_CA_BUNDLE.
GKE menghasilkan insight dan rekomendasi dengan subjenis K8S_CRD_WITH_INVALID_CA_BUNDLE jika cluster GKE memiliki satu atau beberapa CRD yang melaporkan caBundle yang salah dikonfigurasi untuk konfigurasi klien webhook di spec.conversion.webhook.clientConfig.
Bagian berikut berisi petunjuk bagi Anda untuk memecahkan masalah CRD yang
dideteksi berpotensi salah dikonfigurasi oleh GKE.
Setelah Anda menerapkan petunjuk dan CRD dikonfigurasi dengan benar, rekomendasi akan diselesaikan dalam waktu 24 jam dan tidak lagi muncul di konsol.
Jika belum 24 jam sejak Anda menerapkan panduan rekomendasi, Anda dapat menandai rekomendasi tersebut sebagai selesai.
Jika tidak ingin menerapkan rekomendasi, Anda dapat menolaknya.
Mengidentifikasi CRD yang terpengaruh dalam cluster
Lihat insight dan rekomendasi untuk subjenis K8S_CRD_WITH_INVALID_CA_BUNDLE,
pilih insight satu per satu untuk memecahkan masalah. GKE menghasilkan
satu insight per cluster yang memiliki CRD rusak.
Jalankan perintah berikut untuk menjelaskan Service guna menemukan CRD dengan paket CA yang berpotensi menimbulkan masalah:
CaBundle: Paket CA yang terkait dengan webhook konversi CRD, jika ada. Periksa outputnya. Jika kolom caBundle kosong
untuk CRD yang Anda ketahui menggunakan webhook konversi, hal ini menandakan
kemungkinan masalah pada caBundle.
Buat ulang CRD
Untuk mengatasi error ini, buat ulang CRD yang terpengaruh dengan CA bundle yang valid:
Cadangkan resource kustom yang ada dan terkait dengan CRD bermasalah ini, jika ada. Jalankan perintah berikut untuk mengekspor resource yang ada:
kubectlget<crd-name>-oyaml > backup.yaml
Hapus CRD yang ada:
kubectldeletecrd<crd-name>
Pastikan kolom caBundle CRD berisi sertifikat PEM berenkode base-64 yang terbentuk dengan baik. Anda dapat melakukannya dengan mengedit CRD secara langsung atau dengan menghubungi penulisnya.
Ubah definisi YAML CRD, perbarui kolom
spec.conversion.webhook.clientConfig.caBundle dengan data CA bundle yang valid. Hasilnya akan terlihat seperti berikut:
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 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)"]]