Skip to content

Instantly share code, notes, and snippets.

@Piotr1215
Last active January 14, 2024 00:19
Show Gist options
  • Save Piotr1215/23cf678d74079f98dc7be731e6a3f1d1 to your computer and use it in GitHub Desktop.
Save Piotr1215/23cf678d74079f98dc7be731e6a3f1d1 to your computer and use it in GitHub Desktop.

Kubernetes related networking commands

Coming from .NET dev/architect background means that there is a lot to learn in terms of networking and Linux management. Here are CKA curriculum requirements for networking:

RedHat ip command cheatsheet

CKA exam related commands:

ip commands

ip link, ip link show dev em1

Description: display and change the state of network interfaces.

Use cases:

  • identify networking interface for cluster connectivity (ens3)
  • show MAC address on the ens3 network interface (ip link show dev ens3)

ip addr

Description: display IP Addresses and property information assigned to network interfaces.

Use cases:

  • check network range of cluster nodes

ip route or route

Description: view routing table on the host.

Use cases:

  • check default route for dns resolution (ip route show default)

arp

Description: Using the arp command allows you to display and modify the Address Resolution Protocol (ARP) cache. An ARP cache is a simple mapping of IP addresses to MAC addresses. Each time a computer’s TCP/IP stack uses ARP to determine the Media Access Control (MAC) address for an IP address, it records the mapping in the ARP cache so that future ARP lookups go faster.

Use cases:

  • check MAC address of a node

DNS commands

nslookup

Description: query DNS server to resolve domain name

Use cases: check if k9s DNS server (like Core DNS) is working correctly

dig

Description: query DNS server to resolve domain name, similar to nslookup but returns more details

Use cases: check if k9s DNS server (like Core DNS) is working correctly

services commands

ps -aux | grep <service-name>

Use cases:

  • find paths to certificates and other settings for CNI etc ps -aux | grep kubelet

network status

netstat -plnt

Description: In computing, netstat (network statistics) is a command-line tool that displays network connections (both incoming and outgoing), routing tables, and a number of network interface (network interface controller or software-defined network interface) and network protocol statistics

Use cases:

  • check

sockets

ss -lp

Description: - check what opened a socket

CNI commands

https://github.com/containernetworking/cni

cat /etc/cni/net.d/10-weave.conf - check CNI settings (in this case weave), plugin configuration, etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment