Kubernetes Networking, Storage, and Config Cheat Sheet

Services, ingress, EndpointSlices, network policies, PVCs, PVs, storage classes, ConfigMaps, Secrets, and nodes.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all

Services and Ingress

Discover and expose network paths to workloads.

List services

Show services across namespaces.

bashANYserviceget
bash
kubectl get services -A

Show services across namespaces.

Describe service

Inspect selectors, endpoints, ports, and type.

bashANYservicedescribe
bash
kubectl describe service web -n payments

Inspect selectors, endpoints, ports, and type.

List endpoints

Show service endpoint IPs.

bashANYendpointsservice
bash
kubectl get endpoints -n payments

Show service endpoint IPs.

List EndpointSlices

Inspect EndpointSlice objects used for service discovery.

bashANYendpointsliceservice
bash
kubectl get endpointslices -n payments

Inspect EndpointSlice objects used for service discovery.

List ingresses

Show ingress resources across namespaces.

bashANYingressget
bash
kubectl get ingress -A

Show ingress resources across namespaces.

Describe ingress

Inspect rules, backends, and events.

bashANYingressdescribe
bash
kubectl describe ingress web -n payments

Inspect rules, backends, and events.

Port-forward deployment

Forward to a selected pod from a deployment.

bashANYport-forwarddeployment
bash
kubectl port-forward deployment/web 8080:8080 -n payments

Forward to a selected pod from a deployment.

Expose pod as service

Create a service from an existing pod.

bashANYserviceexpose
bash
kubectl expose pod debug-shell --port=8080 --target-port=8080 --name=debug-shell-svc -n tools

Create a service from an existing pod.

Network Policy

Control pod-to-pod traffic flow.

List network policies

Show NetworkPolicy resources.

bashANYnetworkpolicyget
bash
kubectl get networkpolicies -A

Show NetworkPolicy resources.

Describe network policy

Inspect ingress and egress rules.

bashANYnetworkpolicydescribe
bash
kubectl describe networkpolicy default-deny -n payments

Inspect ingress and egress rules.

Apply network policy

Create or update a NetworkPolicy manifest.

bashANYnetworkpolicyapply
bash
kubectl apply -f networkpolicy.yaml

Create or update a NetworkPolicy manifest.

Delete network policy

Remove a NetworkPolicy.

bashANYnetworkpolicydelete
bash
kubectl delete networkpolicy allow-metrics -n observability

Remove a NetworkPolicy.

Persistent Storage

Inspect and manage PVCs, PVs, and StorageClasses.

List PVCs

Show PersistentVolumeClaims across namespaces.

bashANYpvcget
bash
kubectl get pvc -A

Show PersistentVolumeClaims across namespaces.

Describe PVC

Inspect requested storage, status, and bound PV.

bashANYpvcdescribe
bash
kubectl describe pvc data-postgres-0 -n data

Inspect requested storage, status, and bound PV.

List PVs

Show cluster-wide PersistentVolumes.

bashANYpvget
bash
kubectl get pv

Show cluster-wide PersistentVolumes.

Describe PV

Inspect reclaim policy, claim ref, and backing class.

bashANYpvdescribe
bash
kubectl describe pv pvc-12345678

Inspect reclaim policy, claim ref, and backing class.

List storage classes

Show available StorageClasses.

bashANYstorageclassget
bash
kubectl get storageclass

Show available StorageClasses.

Describe storage class

Inspect provisioner and mount options.

bashANYstorageclassdescribe
bash
kubectl describe storageclass gp3

Inspect provisioner and mount options.

Expand PVC size

Request a larger PVC size when the class supports expansion.

bashANYpvcresize
bash
kubectl patch pvc data-postgres-0 -n data -p '{"spec":{"resources":{"requests":{"storage":"200Gi"}}}}'

Request a larger PVC size when the class supports expansion.

Delete PVC

Remove a PVC; PV behavior depends on reclaim policy.

bashANYpvcdelete
bash
kubectl delete pvc cache-data -n payments

Remove a PVC; PV behavior depends on reclaim policy.

ConfigMaps and Secrets

Manage runtime configuration and credentials.

List configmaps

Show ConfigMaps across namespaces.

bashANYconfigmapget
bash
kubectl get configmaps -A

Show ConfigMaps across namespaces.

Describe configmap

Inspect key-value data and metadata.

bashANYconfigmapdescribe
bash
kubectl describe configmap app-config -n payments

Inspect key-value data and metadata.

Edit configmap

Update a ConfigMap live.

bashANYconfigmapedit
bash
kubectl edit configmap app-config -n payments

Update a ConfigMap live.

List secrets

Show Secrets across namespaces.

bashANYsecretget
bash
kubectl get secrets -A

Show Secrets across namespaces.

Describe secret

Inspect secret type and key names without dumping values.

bashANYsecretdescribe
bash
kubectl describe secret app-secret -n payments

Inspect secret type and key names without dumping values.

Get secret key (base64)

Print a base64-encoded secret value.

bashANYsecretjsonpath
bash
kubectl get secret app-secret -n payments -o jsonpath='{.data.API_KEY}'

Print a base64-encoded secret value.

Get decoded secret key

Print a decoded secret value locally.

bashANYsecretjsonpathdecode
bash
kubectl get secret app-secret -n payments -o jsonpath='{.data.API_KEY}' | base64 --decode

Print a decoded secret value locally.

Create secret from env file

Create a secret from an env file.

bashANYsecretcreate
bash
kubectl create secret generic app-env --from-env-file=.env.production -n payments

Create a secret from an env file.

Nodes, Taints, and Scheduling Controls

Inspect cluster nodes and scheduling signals.

List nodes

Show node roles, versions, and internal IPs.

bashANYnodeget
bash
kubectl get nodes -o wide

Show node roles, versions, and internal IPs.

Describe node

Inspect capacity, allocatable, taints, and conditions.

bashANYnodedescribe
bash
kubectl describe node worker-02

Inspect capacity, allocatable, taints, and conditions.

Add taint to node

Add a taint to influence scheduling.

bashANYnodetaint
bash
kubectl taint nodes worker-02 dedicated=ml:NoSchedule

Add a taint to influence scheduling.

Remove taint from node

Remove a taint from a node.

bashANYnodetaintremove
bash
kubectl taint nodes worker-02 dedicated=ml:NoSchedule-

Remove a taint from a node.

Label node

Apply a scheduling label to a node.

bashANYnodelabel
bash
kubectl label node worker-02 nodepool=general --overwrite

Apply a scheduling label to a node.

List pods on node

See what is scheduled on a node.

bashANYnodepods
bash
kubectl get pods -A --field-selector spec.nodeName=worker-02 -o wide

See what is scheduled on a node.