Skip to Content
Asterrr's Handbook
Cheat sheets

Networking, storage and security

Service types, DNS names, volume objects, RBAC objects, Pod Security levels and the 4Cs on one page.

Networking

Kubernetes clusterhost, pathendpointsIngress orGatewaycontrollerServicePodsClientLoad balancer
Traffic from outside reaches a Pod through a controller, a Service and endpoints.
Service typeReachable fromNotes
ClusterIP (default)Inside the clusterStable virtual IP and DNS name
NodePortAny node IP on a port in 30000 to 32767Builds on ClusterIP
LoadBalancerAn external load balancerNeeds a cloud or add-on controller
ExternalNameInside the clusterReturns a DNS CNAME, no proxying
Headless (clusterIP: None)Inside the clusterDNS returns Pod IPs. Used by StatefulSets
  • DNS name of a Service: service.namespace.svc.cluster.local.
  • Every Pod gets its own IP. Pods reach each other without NAT. A CNI plug-in builds that network.
  • A NetworkPolicy only works if the CNI plug-in enforces it.
  • An Ingress object needs an ingress controller. Gateway API is the successor with role-based resources.

Storage

ObjectRole
VolumeStorage attached to a Pod. emptyDir lives as long as the Pod
PersistentVolume (PV)A piece of storage in the cluster
PersistentVolumeClaim (PVC)A request for storage by a user
StorageClassDescribes a kind of storage and enables dynamic provisioning
CSIThe standard plug-in interface that storage drivers implement
  • Access modes: ReadWriteOnce (one node), ReadOnlyMany, ReadWriteMany, ReadWriteOncePod.
  • Reclaim policy: Delete removes the volume with the claim. Retain keeps it for manual cleanup.
  • A StatefulSet uses volumeClaimTemplates to give each Pod its own PVC.

Security

TopicRemember
4CsCloud, Cluster, Container, Code. Each layer builds on the one outside it
Role / RoleBindingPermissions in one namespace
ClusterRole / ClusterRoleBindingPermissions across the cluster, or on cluster-scoped resources
ServiceAccountAn identity for Pods
Pod Security Standardsprivileged, baseline, restricted, applied by namespace labels
SecretsBase64-encoded by default. Turn on encryption at rest and restrict RBAC
AdmissionMutating first, then validating, after authentication and authorization

Base64 is not encryption

A Secret that is only base64-encoded can be read by anyone with access to etcd or to the API object. The answer to "protect Secrets in etcd" is encryption at rest, not another encoding.

On this page