Is it possible to use cloud code extension in vscode to deploy kubernetes pods on a non-GKE cluster?

494 Views Asked by At

This is my very first post here and looking for some advise please.

I am learning Kubernetes and trying to get cloud code extension to deploy Kubernetes manifests on non-GKE cluster. Guestbook app can be deployed using cloud code extension to local K8 cluster(such as MiniKube or Docker-for-Desktop).

I have two other K8 clusters as below and I cannot deploy manifests via cloud code. I am not entirely sure if this is supposed to work or not as I couldn't find any docs or posts on this. Once the GCP free trial is finished, I would want to deploy my test apps on our local onprem K8 clusters via cloud code.

  1. 3 node cluster running on CentOS VMs(built using kubeadm)
  2. 6 node cluster on GCP running on Ubuntu machines(free trial and built using Hightower way)

Skaffold is installed locally on MAC and my local $HOME/.kube/config has contexts and users set to access all 3 clusters. ➜

guestbook-1 kubectl config get-contexts
CURRENT   NAME                          CLUSTER                   AUTHINFO           NAMESPACE
          docker-desktop                docker-desktop            docker-desktop
*         kubernetes-admin@kubernetes   kubernetes                kubernetes-admin
          kubernetes-the-hard-way       kubernetes-the-hard-way   admin

Error:

 Running: skaffold dev -v info --port-forward --rpc-http-port 57337 --filename /Users/testuser/Desktop/Cloud-Code-Builds/guestbook-1/skaffold.yaml -p cloudbuild --default-repo gcr.io/gcptrial-project
starting gRPC server on port 50051
starting gRPC HTTP server on port 57337
Skaffold &{Version:v1.19.0 ConfigVersion:skaffold/v2beta11 GitVersion: GitCommit:63949e28f40deed44c8f3c793b332191f2ef94e4 GitTreeState:dirty BuildDate:2021-01-28T17:29:26Z GoVersion:go1.14.2 Compiler:gc Platform:darwin/amd64}
applying profile: cloudbuild
no values found in profile for field TagPolicy, using original config values
Using kubectl context: kubernetes-admin@kubernetes
Loaded Skaffold defaults from \"/Users/testuser/.skaffold/config\"
Listing files to watch...
 - python-guestbook-backend
watching files for artifact "python-guestbook-backend": listing files: unable to evaluate build args: reading dockerfile: open /Users/adminuser/Desktop/Cloud-Code-Builds/src/backend/Dockerfile: no such file or directory
Exited with code 1.
skaffold config file skaffold.yaml not found - check your current working directory, or try running `skaffold init`

I have the docker and skaffold file in the path as shown in the image and have authenticated the google SDK in vscode. Any help please ?!

enter image description here

1

There are 1 best solutions below

0
On

I was able to get this working in the end. What helped in this particular case was removing skaffold.yaml, then skaffold init, generated new skaffold.yaml. And, Cloud Code was then able deploy pods on both remote clusters. Thanks for all your help.