scylladb / scylla-code-samples

Code samples for working with ScyllaDB
Apache License 2.0
244 stars 131 forks source link

For the "kubernetes-university-live" code sample, the google-cloud-cli-gke-gcloud-auth-plugin dependency is not listed in Scylla U #213

Open GeoffMontee opened 9 months ago

GeoffMontee commented 9 months ago

When following the instructions to use the "kubernetes-university-live" code sample in Scylla U, a dependency is not listed, which causes a failure.

Steps to reproduce

  1. Install gcloud via the Google Cloud SDK.

  2. Initialize gcloud:

gcloud init
  1. Login via gcloud:
gcloud auth login
  1. Install kubectl.

  2. Install helm.

  3. Clone the repo:

git clone https://github.com/scylladb/scylla-code-samples.git
  1. Change directory:
cd scylla-code-samples/kubernetes-university-live
  1. Set the account and project to environment variables:
export GCP_USER=$(gcloud config list account --format "value(core.account)")   
export GCP_PROJECT=$(gcloud config list project --format "value(core.project)") 
  1. Run the gke.sh script:
./gke.sh --gcp-user "$GCP_USER" -p "$GCP_PROJECT" -c "university-live-demo"

Actual results

A failure occurs due to a missing dependency:

Checking if kubectl is present on the machine...
Checking if helm is present on the machine...
WARNING: The `--enable-stackdriver-kubernetes` flag is deprecated and will be removed in an upcoming release. Please use `--logging` and `--monitoring` instead. For more information, please read: https://cloud.google.com/stackdriver/docs/solutions/gke/installing.
Note: Your Pod address range (`--cluster-ipv4-cidr`) can accommodate at most 1008 node(s).
Creating cluster university-live-demo in us-west1-b... Cluster is being health-checked (master is healthy)...done.               
Created [https://container.googleapis.com/v1/projects/skilled-adapter-452/zones/us-west1-b/clusters/university-live-demo].
To inspect the contents of your cluster, go to: https://console.cloud.google.com/kubernetes/workload_/gcloud/us-west1-b/university-live-demo?project=skilled-adapter-452
CRITICAL: ACTION REQUIRED: gke-gcloud-auth-plugin, which is needed for continued use of kubectl, was not found or is not executable. Install gke-gcloud-auth-plugin for use with kubectl by following https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke
kubeconfig entry generated for university-live-demo.
NAME                  LOCATION    MASTER_VERSION      MASTER_IP      MACHINE_TYPE   NODE_VERSION        NUM_NODES  STATUS
university-live-demo  us-west1-b  1.27.8-gke.1067004  35.233.177.76  n1-standard-8  1.27.8-gke.1067004  2          RUNNING
Creating node pool scylla-pool...done.                                                                                           
Created [https://container.googleapis.com/v1beta1/projects/skilled-adapter-452/zones/us-west1-b/clusters/university-live-demo/nodePools/scylla-pool].
NAME         MACHINE_TYPE   DISK_SIZE_GB  NODE_VERSION
scylla-pool  n1-standard-4  20            1.27.8-gke.1067004
Waiting GKE to UPGRADE_MASTER
Waiting for cluster readiness...
university-live-demo us-west1-b 1.27.8-gke.1067004 35.233.177.76 n1-standard-8 1.27.8-gke.1067004 8 RECONCILING
Listed 0 items.
Listed 0 items.
Waiting for cluster readiness... 
university-live-demo us-west1-b 1.27.8-gke.1067004 35.233.177.76 n1-standard-8 1.27.8-gke.1067004 8 RECONCILING
Listed 0 items.
Listed 0 items.
Waiting for cluster readiness... 
university-live-demo us-west1-b 1.27.8-gke.1067004 35.233.177.76 n1-standard-8 1.27.8-gke.1067004 8 RECONCILING
Listed 0 items.
Listed 0 items.
Waiting for cluster readiness... 
university-live-demo us-west1-b 1.27.8-gke.1067004 35.233.177.76 n1-standard-8 1.27.8-gke.1067004 8 RECONCILING
Listed 0 items.
Listed 0 items.
Waiting for cluster readiness... 
university-live-demo us-west1-b 1.27.8-gke.1067004 35.233.177.76 n1-standard-8 1.27.8-gke.1067004 8 RECONCILING
Listed 0 items.
Listed 0 items.
Waiting for cluster readiness... 
university-live-demo us-west1-b 1.27.8-gke.1067004 35.233.177.76 n1-standard-8 1.27.8-gke.1067004 8 RECONCILING
Listed 0 items.
Listed 0 items.
Waiting for cluster readiness... 
university-live-demo us-west1-b 1.27.8-gke.1067004 35.233.177.76 n1-standard-8 1.27.8-gke.1067004 8 RECONCILING
Listed 0 items.
Listed 0 items.
Waiting for cluster readiness... 
university-live-demo us-west1-b 1.27.8-gke.1067004 35.233.177.76 n1-standard-8 1.27.8-gke.1067004 8 RECONCILING
Listed 0 items.
Listed 0 items.
Waiting for cluster readiness... 
university-live-demo us-west1-b 1.27.8-gke.1067004 35.233.177.76 n1-standard-8 1.27.8-gke.1067004 8 RECONCILING
Listed 0 items.
Listed 0 items.
Waiting for cluster readiness... 
university-live-demo us-west1-b 1.27.8-gke.1067004 35.233.177.76 n1-standard-8 1.27.8-gke.1067004 8 RECONCILING
Listed 0 items.
Listed 0 items.
university-live-demo  us-west1-b  1.27.8-gke.1067004  35.233.177.76  n1-standard-8  1.27.8-gke.1067004  8          RUNNING
Getting credentials for newly created cluster...
Fetching cluster endpoint and auth data.
CRITICAL: ACTION REQUIRED: gke-gcloud-auth-plugin, which is needed for continued use of kubectl, was not found or is not executable. Install gke-gcloud-auth-plugin for use with kubectl by following https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke
kubeconfig entry generated for university-live-demo.
Setting up GKE RBAC...
error: failed to create clusterrolebinding: Post "https://35.233.177.76/apis/rbac.authorization.k8s.io/v1/clusterrolebindings?fieldManager=kubectl-create&fieldValidation=Strict": getting credentials: exec: executable gke-gcloud-auth-plugin not found

It looks like you are trying to use a client-go credential plugin that is not installed.

To learn more about this feature, consult the documentation available at:
      https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins

Install gke-gcloud-auth-plugin for use with kubectl by following https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke

Expected results

The missing dependency must be installed prior to running gke.sh:

sudo apt install google-cloud-cli-gke-gcloud-auth-plugin
pdbossman commented 9 months ago

While updating this section, it would be good to also deal with this: WARNING: The --enable-stackdriver-kubernetes flag is deprecated and will be removed in an upcoming release. Please use --logging and --monitoring instead. For more information, please read: https://cloud.google.com/stackdriver/docs/solutions/gke/installing.

@GeoffMontee can you test with the alternate - --logging and --monitoring, removing the --enable-stackdriver-kubernetes flag?

These deprecations are things that will break scylla u when they become removed.

GeoffMontee commented 9 months ago

CC: @erezvelan, @guy9

GeoffMontee commented 9 months ago

Thanks, @pdbossman. I will test this change to avoid the deprecation warning:

diff --git a/kubernetes-university-live/gke.sh b/kubernetes-university-live/gke.sh
index 6a0f97f..ebd1252 100755
--- a/kubernetes-university-live/gke.sh
+++ b/kubernetes-university-live/gke.sh
@@ -143,7 +143,8 @@ clusters create "${CLUSTER_NAME}" \
 --disk-type "pd-ssd" --disk-size "20" \
 --image-type "UBUNTU_CONTAINERD" \
 --system-config-from-file=systemconfig.yaml \
---enable-stackdriver-kubernetes \
+--logging=SYSTEM,WORKLOAD,API_SERVER,CONTROLLER_MANAGER,SCHEDULER \
+--monitoring=SYSTEM,API_SERVER,CONTROLLER_MANAGER,SCHEDULER,DAEMONSET,DEPLOYMENT,HPA,POD,STATEFULSET,STORAGE \
 --no-enable-autoupgrade \
 --no-enable-autorepair \
 --no-enable-ip-alias
tzach commented 9 months ago

@guy9 FYI