Table of contents

CloudBees Core on modern cloud platforms administration guide


Troubleshooting CloudBees Core on modern cloud platforms on Google Kubernetes Engine (GKE)

If your laptop is already set up to interact with the GKE Kubernetes cluster, you may go directly to the general troubleshooting section. Otherwise, follow the next few sections to set up your laptop.

Enable kubectl to interact with GKE-deployed cluster

If the Kubernetes cluster was created using the GKE UI or the CLI gcloud, you will need to perform the following commands on your laptop so that you can interact with that cluster using kubectl.

Authenticate Google account with gcloud

Work with the GKE admin to grant your Google account with access to the following Google API’s:

  • Kubernetes Engine Admin

  • Kubernetes Engine Cluster Admin

Use the following command to authenticate your laptop. By default, the command will launch a browser to facilitate the Google login process. You may also use the --no-launch-browser option to accomplish the same if you are using a headless system.

> gcloud auth application-default login [--no-launch-browser]

Retrieve name of container

Work with your GKE admin to get the name of the Kubernetes cluster. Or you can perform the following command to list all cluster names and choose the correct one to use.

> gcloud container clusters list

Here is an example of the output:

NAME           LOCATION       MASTER_VERSION  MASTER_IP        MACHINE_TYPE    NODE_VERSION  NUM_NODES  STATUS
test20180410c  us-central1-a  1.8.8-gke.0     35.194.43.68     custom-2-5120   1.8.8-gke.0   2          RUNNING
team3-cluster  us-east1-b     1.9.4-gke.1     35.196.148.64    n1-standard-2   1.9.4-gke.1   3          RUNNING
team2-cluster  us-east4-b     1.9.6-gke.0     35.199.21.233    custom-4-16384  1.9.6-gke.0   2          RUNNING
team1-cluster  us-west1-a     1.9.6-gke.0     104.199.113.196  custom-2-8192   1.9.6-gke.0   1          RUNNING

Make a note of the LOCATION of the cluster. In day-to-day interaction, it will be most convenient if you specify a default zone so that you do not have to specify it for every gcloud command against the cluster. Here is an example of setting the zone for the team1-cluster, i.e., "us-west1-a".

gcloud config set compute/zone us-west1-a

Set laptop environment with cluster info

In this section, the cluster "team1-cluster" will be used in the examples.

To attach the gcloud environment to the cluster:

> gcloud config set container/cluster team1-cluster

To pass the cluster’s credentials to kubectl:

> gcloud container clusters get-credentials team1-cluster

Ensure that kubectl can use Application Default Credentials to authenticate to the cluster:

> gcloud auth application-default login [--no-launch-browser]

Provide admin capability to your Google account:

> kubectl create clusterrolebinding cluster-admin-binding  --clusterrole cluster-admin  --user $(gcloud config get-value account)

At this point, your should have an working kubectl environment. You can confirm that with the following command:

> kubectl config get-contexts

If this is the first time that you have done these instructions, there should be one active kubectl context, e.g.,

CURRENT   NAME                                    CLUSTER                                 AUTHINFO                                NAMESPACE
*         gke_account-name-west1-a_team1-cluster  gke_account-name-west1-a_team1-cluster  gke_account-name-west1-a_team1-cluster

Note that there is not a default namespace in the above example. Your CloudBees Core installation will likely be installed in a namespace, e.g., "cje". It is most convenient to set the default namespace so that you do not have to specify it every time that you perform a kubectl command against the CloudBees Core cluster.

kubectl config set-context $(kubectl config current-context) --namespace="cje"

kubectl is now ready to interact with the Kubernetes cluster.

Unresolved directive in gke.adoc - include::troubleshooting/general.adoc[]