[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-09-04 UTC。"],[[["\u003cp\u003eCloud Code enhances Kubernetes and Cloud Build configuration by offering schema linting, smart completions, and documentation hover features for various YAML files.\u003c/p\u003e\n"],["\u003cp\u003eIt supports multiple YAML configuration file types, including Config Management, Cloud Build, Config Connector, Istio, Knative, Kubernetes, Kustomize, and Skaffold, as well as custom resource definitions (CRDs) like Kubeflow.\u003c/p\u003e\n"],["\u003cp\u003eCloud Code allows users to define custom CRD schemas via the \u003ccode\u003ecloudcode.yaml.crdSchemaLocations\u003c/code\u003e setting and automatically pulls schema from clusters running Kubernetes v1.16 or later.\u003c/p\u003e\n"],["\u003cp\u003eIt provides out-of-the-box snippets for common YAML schema, facilitating the creation and modification of YAML files with best practices, including snippets for Anthos Config Management, Cloud Build, Config Connector, Kubernetes, Migrate to Containers, and Skaffold.\u003c/p\u003e\n"],["\u003cp\u003eCloud Code offers features like contextual completions, documentation access on hover, schema validation with error flagging, and the ability to view differences between YAML files, apply changes, and perform dry-runs, all within the development environment.\u003c/p\u003e\n"]]],[],null,["# Work with Google Cloud and Kubernetes YAML in Cloud Code for Cloud Shell\n\nCloud Code for Cloud Shell 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/shell/use-existing-app#set_up_kubernetes_run_configuration) `skaffold.yaml` file.\n- Manually create a [Skaffold configuration](/code/docs/shell/use-existing-app#manually_create_a_skaffold_configuration) for your application.\n- View the [`Skaffold.yaml` reference docs](https://skaffold.dev/docs/references/yaml/)."]]