How to troubleshoot connectivity issues with CD in Kubernetes

Issue

Your CloudBees CD instance has a connectivity issue to some external service (for example, a database), and you would like to troubleshoot if it’s a networking issue or not.

Environment

Resolution

Since the containers do not run as root, you can’t use apt-get to install diagnostic utilities into the Kubernetes pods (such as telnet), so one solution is to manually copy the required binaries into the pod.

We can use another machine with kubectl access to download the appropriate binary (URL below is one example), and then kubectl cp it into the pod, by running:

wget http://mirrors.kernel.org/ubuntu/pool/main/n/netkit-telnet/telnet_0.17-41.2build1_amd64.deb
ar -x telnet_0.17-41.2build1_amd64.deb 
tar -xvf ./data.tar.xz
kubectl cp ./usr/bin/telnet.netkit rkivisto-cd/flow-server-58564585d4-5plpq:/tmp/telnet

In the above, rkivisto-cd is the namespace, and flow-server-58564585d4-5plpq is the pod name, which will be different in your deployment.

Next, we can test if there is network connectivity from the pod to the target server (in this case, a database in Azure), by running:

$ kubectl exec -it pod/flow-server-58564585d4-5plpq -n rkivisto-cd -- /tmp/telnet rkivisto-cd.database.windows.net 1443
Trying 40.78.225.32...
Connected to cr5.eastus1-a.control.database.windows.net.
Escape character is '^]'.

The above output is expected if there is network connectivity on port 1443.

Tested product/plugin versions

Have more questions?

0 Comments

Please sign in to leave a comment.