--- title: Cloud Code # 簡報的名稱 tags: other # 簡報的標籤 --- # Cloud Code ## Install Tool ### [VS Code](https://code.visualstudio.com/) ### [docker client](https://docs.docker.com/get-docker/) ### [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) ### [VSCode Cloud Code](https://github.com/GoogleCloudPlatform/cloud-code-vscode) ### [Skaffold](https://skaffold.dev/docs/install/) ### [Google Cloud SDK](https://cloud.google.com/sdk/install?hl=zh-tw) ## Cloud Code Cmd ### 1. Run On Kubernetes > Cloud Code: Run On Kubernetes #### 1.1. Run On Kubernetes  #### 1.2. Add Configuration  #### 1.3. Artifact Input Wizard  #### 1.4. Use current context  > Cloud Code會自動產生 skaffold.yaml  #### 1.5. 開始偵錯  ##### 這時候就會看到vscode 已經開始偵錯  > Kubectl get all  #### 1.6. 停止偵錯 > 停止 vscode 偵錯,Cloud Code 就會自動砍掉剛才建立的K8S服務   ### 2. Deploy (不推薦使用) > Cloud Code: Deploy #### 2.1 Cloud Code: Deploy  #### 2.2 Continue with Deploy  #### 2.3 選擇[default]  #### 2.4 部署成功  ### 3. Delete > Cloud Code: Delete #### 3.1 Cloud Code: Delete  #### 3.2 直接打要刪除的服務或者按下 Enter 用選的  #### 3.3 選擇要刪除的類型  #### 3.4 選擇名稱  #### 3.5 再次確認  #### 3.6 確認 Deployment 已經被刪除  ### 4. 聚焦 Kubernetes Explorer 檢視  #### 4.1 這邊可以直接看到 k8s 各種服務的運行狀況  ##### 4.1.1 更改 Replicas   #### 4.2 檢視 yaml > 右邊的小框框可以檢視服務相關資訊   #### 4.3 更改 yaml > yaml檔也可以直接編輯     ### 5. Describe > Cloud Code: Describe     ### 6. [Setting up debugging](https://cloud.google.com/code/docs/vscode/setting-up-an-existing-app?hl=zh-tw) #### 6.1 新增設定  #### 6.2 Cloud Code Debug: Attach (NodeJS)  #### 6.3 自動產生 Debug 檔案  #### 6.4 啟動應用程式 > Cloud Code: Run On Kubernetes  #### 6.5 Attach App on Kubernetes Cluster: NodeJS   #### 6.6 這時候就可以針對程式進行偵錯  > P.S 遠端偵錯不支援多個 pod  ### 7. Creat GKE cluster #### 7.1. Select Project  #### 7.2. Select Zone/Region  #### 7.3. Select Configuration    # Referencce * [對 Kubernetes 容器偵錯](https://cloud.google.com/code/docs/vscode/debug?hl=zh-tw) * [Cloud Code for VS Code documentation](https://cloud.google.com/code/docs/vscode?hl=zh-tw) * [GoogleContainerTools/skaffold](https://github.com/GoogleContainerTools/skaffold#installation)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up