[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-04-30。"],[],[],null,["This document shows how to configure prepared credentials for an admin cluster\nin Google Distributed Cloud.\n\nWith prepared credentials, you can store credentials for your admin cluster in a\nSecret in your admin cluster. This provides an element of security, because\nyou don't have to keep passwords and service account keys on your admin\nworkstation.\n\nNote the following limitation with advanced clusters:\n\n- Version 1.31: prepared credentials aren't supported on [advanced clusters](/kubernetes-engine/distributed-cloud/vmware/docs/how-to/admin-cluster-configuration-file-latest#enable-advanced-cluster-field).\n- Version 1.32 and higher: prepared credentials are supported on advanced clusters.\n\nOverview of the procedure\n\n1. Fill in a Secrets configuration file.\n\n2. In your admin cluster configuration file, set enabled to true.\n\n3. Run `gkectl prepare`\n\n4. Create the admin cluster.\n\nFill in your secrets configuration file\n\nGenerate a template for a Secrets configuration file:\n\n```\ngkectl create-config secrets\n```\n\nThe preceding command generates a file named `secrets.yaml`. You can change\nthe name and location of this file if you like.\n\nFamiliarize yourself with the configuration file by reading the\n[Secrets configuration file](/kubernetes-engine/distributed-cloud/vmware/docs/how-to/secrets-configuration-file)\ndocument. You might want to keep this document open in a separate tab or\nwindow.\n\nHere's an example of a Secrets configuration file. The one Secret\ngroup has values for vCenter credentials and four service account keys:\n\n```\napiVersion: v1\nkind: ClusterSecrets\nsecretGroups:\n- secrets\n vCenter:\n username: \"my-vcenter-account\"\n password: \"U$icUKEW#INE\"\n componentAccessServiceAccount:\n serviceAccountKeyPath: \"my-key-folder/component-access-key.json\"\n registerServiceAccount:\n serviceAccountKeyPath: \"my-key-folder/connect-register-key.json\"\n stackdriverServiceAccount:\n serviceAccountKeyPath: \"my-key-folder/log-mon-key.json\"\n cloudAuditLoggingServiceAccount:\n serviceAccountKeyPath: \"my-key-folder/audit-log-key.json\"\n```\n\nAdmin cluster configuration file\n\nCreate an admin cluster configuration file as described in\n[Create an admin cluster](/kubernetes-engine/distributed-cloud/vmware/docs/how-to/create-admin-cluster).\n\nIn your admin cluster configuration file, set\n[`preparedSecrets.enabled`]() to `true`:\n\n```\npreparedsecrets:\n enabled: true\n```\n\nIn your admin cluster configuration file, do not specify values for the\nfollowing fields. These fields are not needed, because Google Distributed Cloud\nwill get credentials and keys from your prepared Secrets.\n\n- `vCenter.credentials.fileRef.path`\n- `componentAccessServiceAccountKeyPath`\n- `loadBalancer.f5BigIP.credentials.fileRef.path`\n- `gkeConnect.registerServiceAccountKeyPath`\n- `stackdriver.serviceAccountKeyPath`\n- `cloudAuditLogging.serviceAccountKeyPath`\n- `privateRegistry.credentials.fileRef.path`\n\nInitialize the environment\n\nImport OS images to vSphere, and push container images to a private registry if one has been specified.:\n\n```\ngkectl prepare --config ADMIN_CLUSTER_CONFIG --secret-config SECRETS_CONFIG\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eADMIN_CLUSTER_CONFIG\u003c/var\u003e: the path of your admin cluster configuration\n file\n\n- \u003cvar translate=\"no\"\u003eSECRETS_CONFIG\u003c/var\u003e: the path of your Secrets configuration file\n\nCreate the admin cluster\n\nCreate the admin cluster:\n\n```\ngkectl create admin --config ADMIN_CLUSTER_CONFIG --secret-config SECRETS_CONFIG\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eADMIN_CLUSTER_CONFIG\u003c/var\u003e: the path of your admin cluster configuration\n file\n\n- \u003cvar translate=\"no\"\u003eSECRETS_CONFIG\u003c/var\u003e: the path of your Secrets configuration file\n\nRotate credentials\n\nTo rotate credentials, you need a Secrets configuration file. There are two\napproaches you can take:\n\n- Run `gkectl create-config secrets` to generate a new Secrets\n configuration file. Fill in the file with new service account keys.\n\n- Generate a Secrets configuration file from the admin cluster. Then replace\n selected service account keys with new ones.\n\n To generate a Secrets configuration file from the admin cluster:\n\n ```\n gkectl get-config admin --export-secrets-config \\\n --bundle-path BUNDLE \\\n --kubeconfig ADMIN_CLUSTER_KUBECONFIG\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eBUNDLE\u003c/var\u003e: the path of the Google Distributed Cloud bundle file\n\n - \u003cvar translate=\"no\"\u003eADMIN_CLUSTER_KUBECONFIG\u003c/var\u003e: the path of the admin cluster\n kubeconfig file\n\nRotate the credentials:\n\n```\ngkectl update credentials CREDENTIAL_TYPE \\\n --config ADMIN_CLUSTER_CONFIG \\\n --kubeconfig ADMIN_CLUSTER_KUBECONFIG \\\n --secret-config SECRETS_CONFIG \\\n --admin-cluster\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eCREDENTIAL_TYPE\u003c/var\u003e: One of the following: vsphere, f5bigip,\n privateregistry, componentaccess, register, stackdriver, cloudauditlogging.\n\n- \u003cvar translate=\"no\"\u003eADMIN_CLUSTER_CONFIG\u003c/var\u003e: the path of the admin cluster configuration\n file\n\n- \u003cvar translate=\"no\"\u003eADMIN_CLUSTER_KUBECONFIG\u003c/var\u003e: the path of the admin cluster kubeconfig\n file\n\n- \u003cvar translate=\"no\"\u003eSECRETS_CONFIG\u003c/var\u003e: the path of the Secrets configuration file\n\nUpdate\n\nTo update an admin cluster that uses prepared credentials, you can, in many\ncases, follow the instructions in as written in\n[Updating a cluster](/kubernetes-engine/distributed-cloud/vmware/docs/how-to/updating-general).\n\nHowever, if you want to enable\n[Cloud Logging and Cloud Monitoring](/kubernetes-engine/distributed-cloud/vmware/docs/how-to/user-cluster-configuration-file-latest#stackdriver-section)\nor\n[Cloud Audit Logs](/kubernetes-engine/distributed-cloud/vmware/docs/how-to/user-cluster-configuration-file-latest#cloudauditlogging-section)\nas part of the update, follow these steps:\n\n1. Generate a [Secrets configuration file](#secrets-configuration-file).\n\n2. In your Secrets configuration file, provide values for\n `stackdriverServiceAccount.serviceAccountKeyPath` and\n `cloudAuditLoggingServiceAccount.serviceAccountKeyPath` or both.\n\n3. Update the cluster:\n\n ```\n gkectl update admin --kubeconfig ADMIN_CLUSTER_KUBECONFIG \\\n --config ADMIN_CLUSTER_CONFIG \\\n --secret-config SECRETS_CONFIG\n ```\n\nRelated documents\n\n- [Secrets configuration file](/kubernetes-engine/distributed-cloud/vmware/docs/how-to/secrets-configuration-file)\n- [Admin cluster configuration file](/kubernetes-engine/distributed-cloud/vmware/docs/how-to/admin-cluster-configuration-file-latest)\n- [Create an admin cluster](/kubernetes-engine/distributed-cloud/vmware/docs/how-to/create-admin-cluster)\n- [Create service accounts](/kubernetes-engine/distributed-cloud/vmware/docs/how-to/service-accounts)\n- [Prepared credentials for a user cluster](/kubernetes-engine/distributed-cloud/vmware/docs/how-to/prepared-credentials)"]]