[[["易于理解","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-08-11。"],[[["\u003cp\u003eCloud Code for VS Code simplifies Kubernetes and Cloud Build configuration by providing schema linting, descriptive errors, smart completions, and documentation on hover.\u003c/p\u003e\n"],["\u003cp\u003eCloud Code supports a wide range of YAML configuration files, including those for Config Management, Cloud Build, Config Connector, Istio, Knative, Kubernetes, Kustomize, and Skaffold, and also supports popular Kubernetes custom resource definitions (CRDs) like Kubeflow.\u003c/p\u003e\n"],["\u003cp\u003eUsers can add custom schema using \u003ccode\u003ecloudcode.yaml.crdSchemaLocations\u003c/code\u003e in their \u003ccode\u003esettings.json\u003c/code\u003e file to point to either a local file or a URL, and the tool automatically fetches CRD schemas from clusters running Kubernetes v1.16 and later.\u003c/p\u003e\n"],["\u003cp\u003eCloud Code offers built-in snippets for common YAML schema, enabling users to quickly create new files or add to existing ones while adhering to best practices, and it automates the completion of repetitive fields.\u003c/p\u003e\n"],["\u003cp\u003eCloud Code provides robust validation features, including flagging invalid tags and values in YAML files, suggesting fixes, performing dry runs as you type, and using red and yellow squiggly lines to indicate errors and warnings, allowing users to view the context of base64 secrets by hovering the mouse over the secret.\u003c/p\u003e\n"]]],[],null,["# Work with Google Cloud and Kubernetes YAML in Cloud Code for VS Code\n\nCloud Code for VS Code is designed to make Kubernetes and Cloud Build\nconfiguration easier by linting schema for both structure and valid values and\nproviding descriptive errors. Cloud Code comes with out-of-the-box\nsolutions for common schema, smart completions, and documentation on hover.\n| **Note:** Cloud Build YAML editing support is only available for files named `cloudbuild.yaml`.\n\nSupported YAML configuration files\n----------------------------------\n\n- [Config Management](/anthos-config-management/docs/how-to/configs)\n- [Cloud Build](/build/docs/build-config)\n- [Config Connector](/config-connector/docs/overview)\n- [Istio](https://istio.io/docs/setup/getting-started/)\n- [Knative](https://knative.dev/docs/)\n- [Kubernetes](https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/)\n- [Kustomize](https://github.com/kubernetes-sigs/kustomize)\n- [Skaffold](https://skaffold.dev/docs/references/yaml/)\n\nCloud Code also supports popular Kubernetes custom resource\ndefinitions (CRDs), like\n[Kubeflow](https://www.kubeflow.org/docs/about/kubeflow/), out-of-the-box.\n\n### Use custom schema\n\nWith Cloud Code, you can provide your own CRD schema with the\n`cloudcode.yaml.crdSchemaLocations` setting in your\n[`settings.json`](https://code.visualstudio.com/docs/getstarted/settings#_settings-file-locations)\nfile.\nYou can point to either a local file or a URL. URLs pointing to `github.com` are\nautomatically converted to `raw.githubusercontent.com`.\n\n### Pull schema from a cluster\n\nWhen you switch to a cluster running Kubernetes v1.16 and later in the\nKubernetes view, Cloud Code automatically pulls the schema of\nall installed CRDs.\n\nConfigure with snippets\n-----------------------\n\nOut-of-the-box snippets for common YAML schema (using `Command/Ctrl+Space` to\nview options) make it easy to start a new YAML file or add to an existing one\nwithout errors, while still following best practices. Cloud Code\nmakes it easier to work with repetitive fields by filling out the remaining\ninstances after you fill in the first field.\n\nCloud Code offers the following snippets:\n\n- `Anthos Config Management - Cluster`\n- `Anthos Config Management - Cluster Selector`\n- `Anthos Config Management - Config Management`\n- `Anthos Config Management - Namespace Selector`\n- `Cloud Build - Cloud Run deployment`\n- `Cloud Build - Docker container build`\n- `Cloud Build - GKE deployment`\n- `Cloud Build - GKE Skaffold deployment`\n- `Cloud Build - Go build`\n- `Cloud Build - Terraform plan + apply`\n- `Config Connector - BigQueryDataset`\n- `Config Connector - BigQueryTable`\n- `Config Connector - BigtableCluster`\n- `Config Connector - BigtableInstance`\n- `Config Connector - PubSubSubscription`\n- `Config Connector - PubSubTopic`\n- `Config Connector - RedisInstance`\n- `Config Connector - SpannerInstance`\n- `Kubernetes - ConfigMap`\n- `Kubernetes - Deployment`\n- `Kubernetes - Ingress`\n- `Kubernetes - Pod`\n- `Kubernetes - Secret`\n- `Kubernetes - Service`\n- `Migrate to Containers - Export`\n- `Migrate to Containers - PersistentVolumeClaim`\n- `Migrate to Containers - StatefulSet`\n- `Skaffold - Bazel`\n- `Skaffold - Getting-started`\n- `Skaffold - Helm deployment`\n- `Skaffold - Kaniko`\n\nComplete with context\n---------------------\n\nBased on the current schema, Cloud Code provides contextual\ncompletions and relevant docs to help you choose the right option.\n\nValidate YAML schema\n--------------------\n\nCloud Code offers schema validation support by flagging invalid tags\nand values in your YAML files and suggesting fixes when possible.\n\nDiscover documentation on hover\n-------------------------------\n\nCloud Code surfaces relevant documentation when you hold the\npointer over a value in the schema.\n\nAccess resource definitions\n---------------------------\n\nTo view definitions for a resource, right-click the resource and then choose\n**Go to Definition** or **Peek Definition**.\n\nApply a YAML file\n-----------------\n\nTo apply a configuration change using the current file, open the command\npalette (press `Ctrl`/`Cmd`+`Shift`+`P` or click **View** \\\u003e **Command Palette** )\nand then run **Cloud Code: Apply Current JSON/YAML File to K8s Deployed Resource**.\n\nThis command brings up a diff view for you to review changes. Click **Apply**\nwhen prompted whether to apply this change. This runs\n[`kubectl apply -f`](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#apply).\n\nView differences between YAML files\n-----------------------------------\n\nTo view the differences between a YAML file in source control and a deployed\nYAML file, open the command palette (press `Ctrl`/`Cmd`+`Shift`+`P` or click\n**View** \\\u003e **Command Palette** ) and then run\n**Cloud Code: Diff Current JSON/YAML File with K8s Deployed Resource**.\n\nPerform a dry-run of a YAML file\n--------------------------------\n\nCloud Code performs dry runs automatically as you type information\nin your YAML file and underlines any errors with a yellow squiggly line.\n\nYellow squiggly lines appear when the server considers a part of your code\nan error based on the result of a dry run. This can include policy violations,\nduplicate names, or validations that Cloud Code doesn't perform on\nthe client side (like max port numbers).\n\nTo view the description of the error in your YAML file, hold your pointer over\nthe code with a yellow underline.\n\nRed squiggly lines appear for detected errors before Cloud Code\nchecks with the Kubernetes server. For example, putting a number where a string\nis expected triggers a red squiggly line.\n\nWork with secrets\n-----------------\n\nUsing configuration maps and\n[secrets](https://kubernetes.io/docs/concepts/configuration/secret/)\nis a key part of working with Kubernetes. To view the context of a base64\nsecret with Cloud Code, hold the pointer over the secret to decode\nit.\n\nWhat's next\n-----------\n\n- Create a [Cloud Code Kubernetes run configuration](/code/docs/vscode/use-existing-app#set_up_kubernetes_run_configuration) `skaffold.yaml` file.\n- Manually create a [Skaffold configuration](/code/docs/vscode/use-existing-app#manually_create_a_skaffold_configuration) for your application.\n- View the [`Skaffold.yaml` reference docs](https://skaffold.dev/docs/references/yaml/).\n\nGet Support\n-----------\n\nTo send feedback, report issues on [GitHub](https://github.com/GoogleCloudPlatform/cloud-code-vscode/issues), or ask a question on [Stack Overflow](https://stackoverflow.com/questions/ask?tags=cloud-code-vscode)."]]