My Kubernetes Debug Container
When I’m Debuggin some problems inside Kubernetes or Openshift environment, I usually need some more tools to work throught the issue. For this purpose I have created separate debugging container that I can deploy and access the tools in that way,
The Dockerfile is quite simple:
1
2
3
4
5
6
7
8
9
10
11
|
FROM ubuntu:22.04
ENV TZ=Europe/Helsinki
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt update && \
apt install -y openssh-client inetutils-ping curl wget sudo bind9-dnsutils inetutils-telnet mysql-client nano vim postgresql-client mongo-tools && \
apt autoremove --yes && rm -rf /var/lib/{apt,dpkg,cache,log}
RUN groupadd -g 1001 tiki && useradd -m -g 1001 tiki && echo "%tiki ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
USER tiki
WORKDIR /home/tiki
CMD ["tail", "-f", "/dev/null"]
|
I have published the Docker Image freely to Quay. It can be pulled from url: quay.io/joonast/ubuntu-debug
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
$ podman pull quay.io/joonast/ubuntu-debug
Trying to pull quay.io/joonast/ubuntu-debug:latest...
Getting image source signatures
Copying blob fcec9b1d30c9 done
Copying blob 08c01a0ec47e done
Copying blob 0ddbb7d5bd84 done
Copying blob 75ecb79da144 done
Copying config 6baf222f26 done
Writing manifest to image destination
Storing signatures
6baf222f26688850ea908f94fa8f4fa120fc16516fe7cc2b9a6fbc79c5f79eef
$ podman images quay.io/joonast/ubuntu-debug
REPOSITORY TAG IMAGE ID CREATED SIZE
quay.io/joonast/ubuntu-debug latest 6baf222f2668 21 months ago 312 MB
|
When I deploy pod from the built Docker image i use this pod.yml configs:
1
2
3
4
5
6
7
8
9
10
|
kind: Pod
apiVersion: v1
metadata:
name: ubuntu-debug
labels:
app: ubuntu-debug
spec:
containers:
- name: ubuntu-debug
image: quay.io/joonast/ubuntu-debug
|
1
|
$ kubectl apply -f pod.yml
|