# DevOps on Cloud 生存法則 - 許育銘、陳鏡宇
> 各家講者出來分享自己的經驗多少都有些公司內規和公關要求的限制,有些不方便分享的地方(例如:不要張貼簡報截圖)還請大家多多包涵喔(不然就更多人不敢出來分享了)
> [name=DevOpsDays Taipei 2022]
如果想一起實作 Skaffold 的話,可以先安裝 Visual Studio Code、Visual Studio Code Cloud Code Extension、Skaffold 以及 Minikube。
> 從這開始
講者筆記 skaffold / cloudcode / cloudbuild / clouddeploy
LinkedIn: https://www.linkedin.com/in/hsuyuming/
github:
Skaffold + fastapi CI example: https://github.com/hsuyuming/devopstw2022_demo_ci
CD example: https://github.com/hsuyuming/devopstw2022_demo_cd
slido Q&A: https://reurl.cc/m3z9XV
### Install VSCode extension
- CloudCode
- Python
### Install skaffold
- Install page: https://skaffold.dev/docs/install/
```cmd
# For Linux x86_64 (amd64)
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 && \
sudo install skaffold /usr/local/bin/
```
- check skaffold version
```
jupyter@abehsu-devops-demo:~/devopstw2022_demo$ skaffold version
v1.39.2
```
### Install helm
```cmd
# Use this script to install Helm requires root privilege
curl -o get-helm-3.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod u+x get-helm-3.sh
./get-helm-3.sh
helm version
helm -h
```
### skaffold + helm chart render example
講者Abe留言: sorry,剛剛最後這part電腦突然出了點小問題,這邊把剛剛沒跑出來的結果跑一次貼上來,大家可以在下面看到DEBU[0000] Running command中他內部幫你執行的helm chart指令.以及注意到render出來的deployment manifest裡面的image在這個步驟就被取代成我們想要的image&tag了
```cmd
(base) jupyter@abehsu-devops-demo:~/devopstw2022_demo$ skaffold render -p docker_with_local_helm_chart --build-artifacts=tags.json -v debug --digest-source=local
DEBU[0000] skaffold API not starting as it's not requested subtask=-1 task=DevLoop
INFO[0000] Skaffold &{Version:v1.39.2 ConfigVersion:skaffold/v2beta29 GitVersion: GitCommit:7ed1d722b53b55ac1c909f00d00a05b47d0964dd BuildDate:2022-08-16T14:29:11Z GoVersion:go1.17 Compiler:gc Platform:linux/amd64 User:} subtask=-1 task=DevLoop
DEBU[0000] Disable housekeeping messages for command explicitly subtask=-1 task=DevLoop
DEBU[0000] config version out of date: upgrading to latest "skaffold/v2beta29" subtask=-1 task=DevLoop
DEBU[0000] parsed 1 configs from configuration file /home/jupyter/devopstw2022_demo/skaffold.yaml subtask=-1 task=DevLoop
INFO[0000] applying profile: docker_with_local_helm_chart subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field Build subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field artifacts subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field insecureRegistries subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field tagPolicy subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field platforms subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field BuildType subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field Test subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field Deploy subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field DeployType subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field docker subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field helm subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field kpt subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field kubectl subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field kustomize subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field statusCheck subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field statusCheckDeadlineSeconds subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field kubeContext subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field logs subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field prefix subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field jsonParse subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field fields subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field PortForward subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field ResourceSelector subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field allow subtask=-1 task=DevLoop
DEBU[0000] overlaying profile on config for field deny subtask=-1 task=DevLoop
INFO[0000] no map entry found when attempting locate for &{docker.io/devopstw22/fastapi_demo fastapi_demo <nil> {0xc0009b68f0 <nil> <nil> <nil> <nil> <nil> <nil>} [] {[] []} []} of type *latest.Artifact and pointer: 824645427968 subtask=-1 task=DevLoop
INFO[0000] Using kubectl context: gke-dev-devops-day_us-west1-a_demo subtask=-1 task=DevLoop
INFO[0000] Loaded Skaffold defaults from "/home/jupyter/.skaffold/config" subtask=-1 task=DevLoop
DEBU[0000] Running command: [minikube version --output=json] subtask=-1 task=DevLoop
DEBU[0000] Command output: [{"commit":"62e108c3dfdec8029a890ad6d8ef96b6461426dc","minikubeVersion":"v1.26.1"}
] subtask=-1 task=DevLoop
DEBU[0000] Running command: [/home/jupyter/.cache/cloud-code/installer/google-cloud-sdk/bin/minikube profile list -o json --user=skaffold] subtask=-1 task=DevLoop
DEBU[0000] Command output: [{"invalid":[],"valid":[{"Name":"minikube","Status":"Stopped","Config":{"Name":"minikube","KeepContext":false,"EmbedCerts":false,"MinikubeISO":"","KicBaseImage":"gcr.io/k8s-minikube/kicbase:v0.0.33@sha256:73b259e144d926189cf169ae5b46bbec4e08e4e2f2bd87296054c3244f70feb8","Memory":2200,"CPUs":2,"DiskSize":20000,"VMDriver":"","Driver":"docker","HyperkitVpnKitSock":"","HyperkitVSockPorts":[],"DockerEnv":null,"ContainerVolumeMounts":null,"InsecureRegistry":null,"RegistryMirror":[],"HostOnlyCIDR":"192.168.59.1/24","HypervVirtualSwitch":"","HypervUseExternalSwitch":false,"HypervExternalAdapter":"","KVMNetwork":"default","KVMQemuURI":"qemu:///system","KVMGPU":false,"KVMHidden":false,"KVMNUMACount":1,"APIServerPort":0,"DockerOpt":null,"DisableDriverMounts":false,"NFSShare":[],"NFSSharesRoot":"/nfsshares","UUID":"","NoVTXCheck":false,"DNSProxy":false,"HostDNSResolver":true,"HostOnlyNicType":"virtio","NatNicType":"virtio","SSHIPAddress":"","SSHUser":"root","SSHKey":"","SSHPort":22,"KubernetesConfig":{"KubernetesVersion":"v1.24.3","ClusterName":"minikube","Namespace":"default","APIServerName":"minikubeCA","APIServerNames":null,"APIServerIPs":null,"DNSDomain":"cluster.local","ContainerRuntime":"docker","CRISocket":"","NetworkPlugin":"","FeatureGates":"","ServiceCIDR":"10.96.0.0/12","ImageRepository":"","LoadBalancerStartIP":"","LoadBalancerEndIP":"","CustomIngressCert":"","RegistryAliases":"","ExtraOptions":null,"ShouldLoadCachedImages":true,"EnableDefaultCNI":false,"CNI":"","NodeIP":"","NodePort":8443,"NodeName":""},"Nodes":[{"Name":"","IP":"192.168.49.2","Port":8443,"KubernetesVersion":"v1.24.3","ContainerRuntime":"docker","ControlPlane":true,"Worker":true}],"Addons":{"ambassador":false,"auto-pause":false,"csi-hostpath-driver":false,"dashboard":false,"default-storageclass":true,"efk":false,"freshpod":false,"gcp-auth":false,"gvisor":false,"headlamp":false,"helm-tiller":false,"inaccel":false,"ingress":false,"ingress-dns":false,"istio":false,"istio-provisioner":false,"kong":false,"kubevirt":false,"logviewer":false,"metallb":false,"metrics-server":false,"nvidia-driver-installer":false,"nvidia-gpu-device-plugin":false,"olm":false,"pod-security-policy":false,"portainer":false,"registry":false,"registry-aliases":false,"registry-creds":false,"storage-provisioner":true,"storage-provisioner-gluster":false,"volumesnapshots":false},"CustomAddonImages":{"GCPAuthWebhook":"k8s-minikube/gcp-auth-webhook:v0.0.10@sha256:1ce1510da2a4af923e678d487ec0a78f4a8f2a65206a3aa8de659a196ae98d0f","KubeWebhookCertgen":"k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0@sha256:f3b6b39a6062328c095337b4cadcefd1612348fdd5190b1dcbcb9b9e90bd8068"},"CustomAddonRegistries":{},"VerifyComponents":{"apiserver":true,"system_pods":true},"StartHostTimeout":360000000000,"ScheduledStop":null,"ExposedPorts":[],"ListenAddress":"","Network":"","Subnet":"","MultiNodeRequested":false,"ExtraDisks":0,"CertExpiration":94608000000000000,"Mount":false,"MountString":"/home/jupyter:/minikube-host","Mount9PVersion":"9p2000.L","MountGID":"docker","MountIP":"","MountMSize":262144,"MountOptions":[],"MountPort":0,"MountType":"9p","MountUID":"docker","BinaryMirror":"","DisableOptimizations":false,"DisableMetrics":false,"CustomQemuFirmwarePath":""},"Active":true}]}] subtask=-1 task=DevLoop
DEBU[0000] Running command: [/home/jupyter/.cache/cloud-code/installer/google-cloud-sdk/bin/minikube profile list -o json --user=skaffold] subtask=-1 task=DevLoop
DEBU[0000] Command output: [{"invalid":[],"valid":[{"Name":"minikube","Status":"Stopped","Config":{"Name":"minikube","KeepContext":false,"EmbedCerts":false,"MinikubeISO":"","KicBaseImage":"gcr.io/k8s-minikube/kicbase:v0.0.33@sha256:73b259e144d926189cf169ae5b46bbec4e08e4e2f2bd87296054c3244f70feb8","Memory":2200,"CPUs":2,"DiskSize":20000,"VMDriver":"","Driver":"docker","HyperkitVpnKitSock":"","HyperkitVSockPorts":[],"DockerEnv":null,"ContainerVolumeMounts":null,"InsecureRegistry":null,"RegistryMirror":[],"HostOnlyCIDR":"192.168.59.1/24","HypervVirtualSwitch":"","HypervUseExternalSwitch":false,"HypervExternalAdapter":"","KVMNetwork":"default","KVMQemuURI":"qemu:///system","KVMGPU":false,"KVMHidden":false,"KVMNUMACount":1,"APIServerPort":0,"DockerOpt":null,"DisableDriverMounts":false,"NFSShare":[],"NFSSharesRoot":"/nfsshares","UUID":"","NoVTXCheck":false,"DNSProxy":false,"HostDNSResolver":true,"HostOnlyNicType":"virtio","NatNicType":"virtio","SSHIPAddress":"","SSHUser":"root","SSHKey":"","SSHPort":22,"KubernetesConfig":{"KubernetesVersion":"v1.24.3","ClusterName":"minikube","Namespace":"default","APIServerName":"minikubeCA","APIServerNames":null,"APIServerIPs":null,"DNSDomain":"cluster.local","ContainerRuntime":"docker","CRISocket":"","NetworkPlugin":"","FeatureGates":"","ServiceCIDR":"10.96.0.0/12","ImageRepository":"","LoadBalancerStartIP":"","LoadBalancerEndIP":"","CustomIngressCert":"","RegistryAliases":"","ExtraOptions":null,"ShouldLoadCachedImages":true,"EnableDefaultCNI":false,"CNI":"","NodeIP":"","NodePort":8443,"NodeName":""},"Nodes":[{"Name":"","IP":"192.168.49.2","Port":8443,"KubernetesVersion":"v1.24.3","ContainerRuntime":"docker","ControlPlane":true,"Worker":true}],"Addons":{"ambassador":false,"auto-pause":false,"csi-hostpath-driver":false,"dashboard":false,"default-storageclass":true,"efk":false,"freshpod":false,"gcp-auth":false,"gvisor":false,"headlamp":false,"helm-tiller":false,"inaccel":false,"ingress":false,"ingress-dns":false,"istio":false,"istio-provisioner":false,"kong":false,"kubevirt":false,"logviewer":false,"metallb":false,"metrics-server":false,"nvidia-driver-installer":false,"nvidia-gpu-device-plugin":false,"olm":false,"pod-security-policy":false,"portainer":false,"registry":false,"registry-aliases":false,"registry-creds":false,"storage-provisioner":true,"storage-provisioner-gluster":false,"volumesnapshots":false},"CustomAddonImages":{"GCPAuthWebhook":"k8s-minikube/gcp-auth-webhook:v0.0.10@sha256:1ce1510da2a4af923e678d487ec0a78f4a8f2a65206a3aa8de659a196ae98d0f","KubeWebhookCertgen":"k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0@sha256:f3b6b39a6062328c095337b4cadcefd1612348fdd5190b1dcbcb9b9e90bd8068"},"CustomAddonRegistries":{},"VerifyComponents":{"apiserver":true,"system_pods":true},"StartHostTimeout":360000000000,"ScheduledStop":null,"ExposedPorts":[],"ListenAddress":"","Network":"","Subnet":"","MultiNodeRequested":false,"ExtraDisks":0,"CertExpiration":94608000000000000,"Mount":false,"MountString":"/home/jupyter:/minikube-host","Mount9PVersion":"9p2000.L","MountGID":"docker","MountIP":"","MountMSize":262144,"MountOptions":[],"MountPort":0,"MountType":"9p","MountUID":"docker","BinaryMirror":"","DisableOptimizations":false,"DisableMetrics":false,"CustomQemuFirmwarePath":""},"Active":true}]}] subtask=-1 task=DevLoop
DEBU[0000] setting Docker user agent to skaffold-v1.39.2 subtask=-1 task=DevLoop
DEBU[0000] Running command: [helm version --client] subtask=-1 task=DevLoop
DEBU[0000] Command output: [version.BuildInfo{Version:"v3.9.4", GitCommit:"dbc6d8e20fe1d58d50e6ed30f09a04a77e4c68db", GitTreeState:"clean", GoVersion:"go1.17.13"}
] subtask=-1 task=DevLoop
DEBU[0000] CLI platforms provided: "" subtask=-1 task=DevLoop
DEBU[0000] platforms detected from active kubernetes cluster nodes: "" subtask=-1 task=DevLoop
DEBU[0000] platforms selected for artifact "docker.io/devopstw22/fastapi_demo": "" subtask=-1 task=DevLoop
DEBU[0000] Using builder: local subtask=-1 task=DevLoop
INFO[0000] build concurrency first set to 1 parsed from *local.Builder[0] subtask=-1 task=DevLoop
INFO[0000] final build concurrency value is 1 subtask=-1 task=DevLoop
DEBU[0000] Executing template &{envTemplate 0xc000b36ea0 0xc0004dc000 } with environment map[BINARIES_PATH:/opt/deeplearning/binaries BROWSER:/home/jupyter/.vscode-server/bin/e4503b30fc78200f846c62cf8091b76ff5547662/bin/helpers/browser.sh COLORTERM:truecolor CONDA_DEFAULT_ENV:base CONDA_EXE:/opt/conda/bin/conda CONDA_PREFIX:/opt/conda CONDA_PROMPT_MODIFIER:(base) CONDA_PYTHON_EXE:/opt/conda/bin/python CONDA_SHLVL:1 DBUS_SESSION_BUS_ADDRESS:unix:path=/run/user/1000/bus DL_ANACONDA_HOME:/opt/conda DL_BIN_PATH:/opt/deeplearning/bin DL_METADATA_PATH:/opt/deeplearning/metadata DL_PATH:/opt/deeplearning DL_PATH_DEPS:/opt/deeplearning/deps ENV_URI_FILE_PATH:/opt/deeplearning/metadata/env_uri ENV_VERSION_FILE_PATH:/opt/deeplearning/metadata/env_version FRAMEWORK_FILE_PATH:/opt/deeplearning/metadata/framework GIT_ASKPASS:/home/jupyter/.vscode-server/bin/e4503b30fc78200f846c62cf8091b76ff5547662/extensions/git/dist/askpass.sh GRPC_FORK_SUPPORT_ENABLED:0 HOME:/home/jupyter JUPYTER_DEPS_PATH:/opt/deeplearning/jupyter LANG:C.UTF-8 LIT_PROXY_URL:/proxy/%PORT%/ LOGNAME:jupyter MAIL:/var/mail/jupyter MOUNTS_ON_ALL_CONTAINERS:/usr/local/share/ca-certificates,/etc/ssl/certs,/etc/ca-certificates/update.d OPAL_PREFIX:/usr OS_DEBIAN10:debian-10 OS_DEBIAN_PROJECT:debian-cloud OS_IMAGE_FAMILY:debian-10 OS_IMAGE_PROJECT:debian-cloud OS_UBUNTU2004:ubuntu-2004-lts PACKAGE_SOURCE_CODE_PATH:/opt/deeplearning/src/third_party PATH:/home/jupyter/.cache/cloud-code/installer/google-cloud-sdk/bin:/home/jupyter/.vscode-server/bin/e4503b30fc78200f846c62cf8091b76ff5547662/bin/remote-cli:/opt/conda/bin:/opt/conda/condabin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games POST_STARTUP_SCRIPT_PATH:/opt/c2d/post_start.sh PWD:/home/jupyter/devopstw2022_demo RESTRICTION_TYPE_FILE_PATH:/opt/deeplearning/restriction SHELL:/bin/bash SHLVL:2 SRC_PATH:/opt/deeplearning/src SSH_CLIENT:10.6.150.132 58339 22 SSH_CONNECTION:10.6.150.132 58339 10.8.1.237 22 TENSORBOARD_PROXY_URL:/proxy/%PORT%/ TERM:xterm-256color TERM_PROGRAM:vscode TERM_PROGRAM_VERSION:1.70.2 TITLE_FILE_PATH:/opt/deeplearning/metadata/title TUTORIALS_PATH:/opt/deeplearning/workspace/tutorials USER:jupyter VERSION_FILE_PATH:/opt/deeplearning/metadata/version VSCODE_GIT_ASKPASS_EXTRA_ARGS: VSCODE_GIT_ASKPASS_MAIN:/home/jupyter/.vscode-server/bin/e4503b30fc78200f846c62cf8091b76ff5547662/extensions/git/dist/askpass-main.js VSCODE_GIT_ASKPASS_NODE:/home/jupyter/.vscode-server/bin/e4503b30fc78200f846c62cf8091b76ff5547662/node VSCODE_GIT_IPC_HANDLE:/run/user/1000/vscode-git-f9fd202419.sock VSCODE_IPC_HOOK_CLI:/run/user/1000/vscode-ipc-d2db7f5d-7344-4812-a3fd-d181b2d5c415.sock WORKSPACE_PATH:/opt/deeplearning/workspace XDG_RUNTIME_DIR:/run/user/1000 XDG_SESSION_CLASS:user XDG_SESSION_ID:3 XDG_SESSION_TYPE:tty _:/home/jupyter/.cache/cloud-code/installer/google-cloud-sdk/bin/skaffold _CE_CONDA: _CE_M:] subtask=-1 task=DevLoop
DEBU[0000] EnvVarMap: map[DIGEST:docker.io/devopstw22/fastapi_demo:0.1.0@sha256:136a0de60e099c579f8ee6f97437cfbdd101050f21cef5922a5540f87b5bd49b DIGEST_ALGO:docker.io/devopstw22/fastapi_demo DIGEST_HEX:0.1.0@sha256:136a0de60e099c579f8ee6f97437cfbdd101050f21cef5922a5540f87b5bd49b IMAGE_DIGEST:sha256:136a0de60e099c579f8ee6f97437cfbdd101050f21cef5922a5540f87b5bd49b IMAGE_NAME:docker.io/devopstw22/fastapi_demo IMAGE_REPO:docker.io/devopstw22/fastapi_demo IMAGE_TAG:0.1.0] subtask=-1 task=DevLoop
DEBU[0000] Executing template &{envTemplate 0xc0005ae000 0xc0004dc050 } with environment map[BINARIES_PATH:/opt/deeplearning/binaries BROWSER:/home/jupyter/.vscode-server/bin/e4503b30fc78200f846c62cf8091b76ff5547662/bin/helpers/browser.sh COLORTERM:truecolor CONDA_DEFAULT_ENV:base CONDA_EXE:/opt/conda/bin/conda CONDA_PREFIX:/opt/conda CONDA_PROMPT_MODIFIER:(base) CONDA_PYTHON_EXE:/opt/conda/bin/python CONDA_SHLVL:1 DBUS_SESSION_BUS_ADDRESS:unix:path=/run/user/1000/bus DIGEST:docker.io/devopstw22/fastapi_demo:0.1.0@sha256:136a0de60e099c579f8ee6f97437cfbdd101050f21cef5922a5540f87b5bd49b DIGEST_ALGO:docker.io/devopstw22/fastapi_demo DIGEST_HEX:0.1.0@sha256:136a0de60e099c579f8ee6f97437cfbdd101050f21cef5922a5540f87b5bd49b DL_ANACONDA_HOME:/opt/conda DL_BIN_PATH:/opt/deeplearning/bin DL_METADATA_PATH:/opt/deeplearning/metadata DL_PATH:/opt/deeplearning DL_PATH_DEPS:/opt/deeplearning/deps ENV_URI_FILE_PATH:/opt/deeplearning/metadata/env_uri ENV_VERSION_FILE_PATH:/opt/deeplearning/metadata/env_version FRAMEWORK_FILE_PATH:/opt/deeplearning/metadata/framework GIT_ASKPASS:/home/jupyter/.vscode-server/bin/e4503b30fc78200f846c62cf8091b76ff5547662/extensions/git/dist/askpass.sh GRPC_FORK_SUPPORT_ENABLED:0 HOME:/home/jupyter IMAGE_DIGEST:sha256:136a0de60e099c579f8ee6f97437cfbdd101050f21cef5922a5540f87b5bd49b IMAGE_NAME:docker.io/devopstw22/fastapi_demo IMAGE_REPO:docker.io/devopstw22/fastapi_demo IMAGE_TAG:0.1.0 JUPYTER_DEPS_PATH:/opt/deeplearning/jupyter LANG:C.UTF-8 LIT_PROXY_URL:/proxy/%PORT%/ LOGNAME:jupyter MAIL:/var/mail/jupyter MOUNTS_ON_ALL_CONTAINERS:/usr/local/share/ca-certificates,/etc/ssl/certs,/etc/ca-certificates/update.d OPAL_PREFIX:/usr OS_DEBIAN10:debian-10 OS_DEBIAN_PROJECT:debian-cloud OS_IMAGE_FAMILY:debian-10 OS_IMAGE_PROJECT:debian-cloud OS_UBUNTU2004:ubuntu-2004-lts PACKAGE_SOURCE_CODE_PATH:/opt/deeplearning/src/third_party PATH:/home/jupyter/.cache/cloud-code/installer/google-cloud-sdk/bin:/home/jupyter/.vscode-server/bin/e4503b30fc78200f846c62cf8091b76ff5547662/bin/remote-cli:/opt/conda/bin:/opt/conda/condabin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games POST_STARTUP_SCRIPT_PATH:/opt/c2d/post_start.sh PWD:/home/jupyter/devopstw2022_demo RESTRICTION_TYPE_FILE_PATH:/opt/deeplearning/restriction SHELL:/bin/bash SHLVL:2 SRC_PATH:/opt/deeplearning/src SSH_CLIENT:10.6.150.132 58339 22 SSH_CONNECTION:10.6.150.132 58339 10.8.1.237 22 TENSORBOARD_PROXY_URL:/proxy/%PORT%/ TERM:xterm-256color TERM_PROGRAM:vscode TERM_PROGRAM_VERSION:1.70.2 TITLE_FILE_PATH:/opt/deeplearning/metadata/title TUTORIALS_PATH:/opt/deeplearning/workspace/tutorials USER:jupyter VERSION_FILE_PATH:/opt/deeplearning/metadata/version VSCODE_GIT_ASKPASS_EXTRA_ARGS: VSCODE_GIT_ASKPASS_MAIN:/home/jupyter/.vscode-server/bin/e4503b30fc78200f846c62cf8091b76ff5547662/extensions/git/dist/askpass-main.js VSCODE_GIT_ASKPASS_NODE:/home/jupyter/.vscode-server/bin/e4503b30fc78200f846c62cf8091b76ff5547662/node VSCODE_GIT_IPC_HANDLE:/run/user/1000/vscode-git-f9fd202419.sock VSCODE_IPC_HOOK_CLI:/run/user/1000/vscode-ipc-d2db7f5d-7344-4812-a3fd-d181b2d5c415.sock WORKSPACE_PATH:/opt/deeplearning/workspace XDG_RUNTIME_DIR:/run/user/1000 XDG_SESSION_CLASS:user XDG_SESSION_ID:3 XDG_SESSION_TYPE:tty _:/home/jupyter/.cache/cloud-code/installer/google-cloud-sdk/bin/skaffold _CE_CONDA: _CE_M:] subtask=-1 task=DevLoop
DEBU[0000] Running command: [helm --kube-context gke-dev-devops-day_us-west1-a_demotemplate fastapi-helm fastapi_demo/helm_charts --set-string image.repository=docker.io/devopstw22/fastapi_demo,image.tag=0.1.0@sha256:136a0de60e099c579f8ee6f97437cfbdd101050f21cef5922a5540f87b5bd49b -f fastapi_demo/helm_charts/values.yaml] subtask=-1 task=DevLoop
---
# Source: skaffold-helm-fastapi/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
annotations:
networking.gke.io/load-balancer-type: "Internal"
networking.gke.io/internal-load-balancer-allow-global-access: "true"
name: fastapi
spec:
selector:
app: fastapi
ports:
- protocol: "TCP"
port: 8081
targetPort: 8081
type: LoadBalancer
---
# Source: skaffold-helm-fastapi/templates/deployment.yaml
# Deployment
# Defines the deployment of the app running in a pod on any worker node
apiVersion: apps/v1
kind: Deployment
metadata:
name: fastapi
labels:
app: fastapi
spec:
replicas: 1
selector:
matchLabels:
app: fastapi
template:
metadata:
labels:
app: fastapi
spec:
containers:
- name: skaffold-helm-fastapi
image: docker.io/devopstw22/fastapi_demo:0.1.0@sha256:136a0de60e099c579f8ee6f97437cfbdd101050f21cef5922a5540f87b5bd49b
imagePullPolicy: Always
command: ["python", "-m"]
args: [ "uvicorn", "--reload", "--host", "0.0.0.0", "src.fastapi_demo.fastapi_demo:app", "--port", "8081"]
resources:
# You must specify requests for CPU to autoscale
# based on CPU utilization
requests:
cpu: "250m"
```