Showing posts with label image. Show all posts
Showing posts with label image. Show all posts

Sunday, October 29, 2023

Kubernetes 101 - Part12 - Debug pod

When it comes to troubleshooting application connectivity and name resolution issues in Kubernetes, having the right tools at your disposal can make all the difference. One of the most common challenges is accessing essential utilities like ping, nslookup, dig, traceroute, and more. To simplify this process, we've created a container image that packs a range of these utilities, making it easy to quickly identify and resolve connectivity issues.

 

The Container Image: A Swiss Army Knife for Troubleshooting

This container image, designed specifically for Kubernetes troubleshooting, comes pre-installed with the following essential utilities:

  1. ping: A classic network diagnostic tool for testing connectivity.
  2. dig: A DNS lookup tool for resolving domain names to IP addresses.
  3. nslookup: A network troubleshooting tool for resolving hostnames to IP addresses.
  4. traceroute: A network diagnostic tool for tracing the path of packets across a network.
  5. curl: A command-line tool for transferring data to and from a web server using HTTP, HTTPS, SCP, SFTP, TFTP, and more.
  6. wget: A command-line tool for downloading files from the web.
  7. nc: A command-line tool for reading and writing data to a network socket.
  8. netstat: A command-line tool for displaying network connections, routing tables, and interface statistics.
  9. ifconfig: A command-line tool for configuring network interfaces.
  10. route: A command-line tool for displaying and modifying the IP routing table.
  11. host: A command-line tool for performing DNS lookups and resolving hostnames.
  12. arp: A command-line tool for displaying and modifying the ARP cache.
  13. iostat: A command-line tool for displaying disk I/O statistics.
  14. top: A command-line tool for displaying system resource usage.
  15. free: A command-line tool for displaying free memory and swap space.
  16. vmstat: A command-line tool for displaying virtual memory statistics.
  17. pmap: A command-line tool for displaying process memory maps.
  18. mpstat: A command-line tool for displaying multiprocessor statistics.
  19. python3: A programming language and interpreter.
  20. pip: A package installer for Python.

 

Run as a pod on Kubernetes

kubectl run debug --image=vineethac/debug -n default -- sleep infinity

 

Exec into the debug pod

kubectl exec -it debug -n default -- bash 
root@debug:/# ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_seq=1 ttl=46 time=49.3 ms 64 bytes from 8.8.8.8: icmp_seq=2 ttl=45 time=57.4 ms 64 bytes from 8.8.8.8: icmp_seq=3 ttl=46 time=49.4 ms ^C --- 8.8.8.8 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2003ms rtt min/avg/max/mdev = 49.334/52.030/57.404/3.799 ms root@debug:/#
root@debug:/# nslookup google.com Server: 10.96.0.10 Address: 10.96.0.10#53 Non-authoritative answer: Name: google.com Address: 142.250.72.206 Name: google.com Address: 2607:f8b0:4005:80c::200e root@debug:/# exit exit ❯

 

Reference

https://github.com/vineethac/Docker/tree/main/debug-image

By having these essential utilities at your fingertips, you'll be better equipped to quickly identify and resolve connectivity issues in your Kubernetes cluster, saving you time and reducing the complexity of troubleshooting.

Hope it was useful. Cheers!

Wednesday, October 23, 2019

Docker 101 - Part4 - Creating images using dockerfile

In this article, I will briefly explain how to create your own image using Dockerfile. For example, I will be creating an FIO image. FIO is a storage stress test tool and this image can be used for container storage IO benchmarking/ testing.

  • Login to the CentOS docker host.
  • Create a file named "Dockerfile".
  • # vi Dockerfile
  • Add the below two lines and save it.

  • # docker build ./

  • Once the build is complete, it returns the IMAGE ID as shown below.
  • You can use the "docker tag" command to mention a repository and tag to the image. 

  • At this stage, as shown in the above screenshot, the FIO image is created with repository "vineethac/fio_image" and tagged as "latest".
  • You can run this image as given below.

  • # docker run -dit --name FIO_test01 --mount source=disk_data,target=/vol vineethac/fio_image fio --name=RandomReadTest1 --readwrite=randread --rwmixwrite=0 --bs=4k --invalidate=1 --direct=1 --filename=/vol/newfile --size=10g --time_based --runtime=300 --ioengine=libaio --numjobs=2 --iodepth=1 --norandommap --randrepeat=0 --exitall


  • The above command will start a container with FIO application running inside it. FIO will use "/vol/newfile" for IO tests. "/vol" is using "disk_data" directory which is inside "/var/lib/docker/volumes". Once the test is complete, the container will exit.

Hope it was useful. Cheers!

Related posts


Docker 101 - Part3 - Persisting data using volumes

Docker 101 - Part2 - Basic operations

Docker 101 - Part1 - Installation