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.

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:

Note that there is not a default namespace in the above example. Your CloudBees Jenkins Enterprise 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 Jenkins Enterprise cluster.

Once the installation is done and the CloudBees Jenkins Enterprise cluster is already up and running, then we can easily check the status of the most important CloudBees Jenkins Enterprise resources: pod,statefulset,svc,ingress,pvc and pv.

In the following sections the expected results of different Kubernetes resources are defined. The definition of each Kubernetes resource was taken from Kubernetes official documentation.

Pods

A pod is the smallest and simplest Kubernetes object, which represents a set of running containers on your cluster. A Pod is typically set up to run a single primary container, although a pod can also run optional sidecar containers that add supplementary features like logging. Pods are commonly managed by a Deployment.

The get pod will provide you current applications running in the cluster. Applications which are currently stopped or not deployed will not appear as a pod of the cluster.

Pods Events

Pod events provide you insights about why a specific pod is failing to start in the cluster. In other words, pod events will tell you the reason why a specific application cannot start or be deployed in the cluster.

The table below summarize the most common pods event which might happen in CloudBees Jenkins Enterprise.

To get the list of events associated with a given pod you will need to run:

$ kubectl describe pod the_pod_name

For example:

$ kubectl describe pod cjoc-0

Status

Events

Cause

ImagePullBackOff

The image you are using cannot be found in the Docker registry, or when using a private registry there is no secret configured

Node issues

See below. Get node info with kubectl describe nodes

Pending

Insufficient memory

Not enough memory, either increase the nodes or node size in the cluster or reduce the memory requirement of Operations Center (yaml file) or Master (under configuration)

Pending

Insufficient cpu

Not enough CPUs, either increase the nodes or node size in the cluster or reduce the CPU requirement of Operations Center (yaml file) or Master (under configuration)

Pending

NoVolumeZoneConflict

There are no nodes available in the zone where the persistent volume was created, start more nodes in that zone

Pending

CrashLoopBackOff

Find out why the Docker container crashes. The easiest and first check should be if there are any errors in the output of the previous startup, e.g.:

The Xmx or MaxRAM JVM parameters are too high for the container memory, try increasing memory limit

Unknown

This usually indicates a bad node, if there are several pods in that node in the same state. Check with `kubectl get pods --all-namespaces -o wide

StatefulSet

A StatefulSet manages the deployment and scaling of a set of Pods and provides guarantees about the ordering and uniqueness of these Pods.

Like a Deployment, a StatefulSet manages Pods that are based on an identical container spec. Unlike a Deployment, a StatefulSet maintains a sticky identity for each of their Pods. These pods are created from the same spec, but are not interchangeable: each has a persistent identifier that it maintains across any rescheduling.

A StatefulSet operates under the same pattern as any other Controller. You define your desired state in a StatefulSet object and the StatefulSet controller makes any necessary updates to get there from the current state.

The product expects these ingresses to be present and so they must not be modified - even to reduce the complexity of scope. Modifying ingresses at the Kubernetes level might produce issues in the product, such as Managed Masters becoming unable to communicate correctly with the Operations Center.

Persistent Volume Claims (PVC)

Persistent volume claims (PVCs) represent the volumes associated which each application running in the cluster.

The registered trademark Jenkins® is used pursuant to a sublicense from the Jenkins project and Software in the Public Interest, Inc. Read more at
www.cloudbees.com/jenkins/about.

Apache, Apache Ant, Apache Maven, Ant and Maven are trademarks of
The Apache Software Foundation. Used with permission. No endorsement by
The Apache Software Foundation is implied by the use of these marks.

Other names may be trademarks of their respective owners.
Many of the designations used by manufacturers and sellers
to distinguish their products are claimed as trademarks. Where those
designations appear in this book, and CloudBees was aware
of a trademark claim, the designations have been printed in caps or initial
caps.

While every precaution has been taken in the preparation of this book,
the publisher and authors assume no responsibility for errors or omissions,
or for damages resulting from the use of the information contained
herein.