## Services
A Service is a Kubernetes object that defines a logical set of Pods and a policy by which to access them. Services provide a stable network endpoint (IP address and DNS name) for a dynamic set of Pods, which are often ephemeral. Services use label selectors to identify the Pods they target.
There are several Service Types:
kube-proxy is a network proxy that runs on each node in the cluster, implementing the Service concept. It maintains network rules (e.g., iptables or IPVS) to forward traffic to the correct backend Pods. EndpointSlices are a more scalable and efficient way to track network endpoints for Services, especially in large clusters, replacing the older Endpoints resource.
## Ingress
Ingress is an API object that manages external access to services in a cluster, typically HTTP/HTTPS. It provides routing rules for traffic based on hostnames and paths to backend Services. An Ingress Controller is essential for Ingress resources to function; it's a specialized pod that watches the Ingress API and configures a load balancer or proxy accordingly (e.g., Nginx, HAProxy). Ingress can also be configured for TLS termination using Kubernetes Secrets.
## Network Policies
NetworkPolicy is an API object that allows you to specify how groups of Pods are allowed to communicate with each other and other network endpoints. By default, Pods are non-isolated, meaning they can communicate freely. Network Policies provide pod-level isolation. They use podSelectors to select the target Pods and define rules for Ingress (incoming traffic) and Egress (outgoing traffic). Rules can specify communication based on Pods, Namespaces, or IP blocks (`ipBlock`). A Container Network Interface (CNI) plugin that supports NetworkPolicy (e.g., Calico) is required for them to be enforced.
## DNS
CoreDNS is the default DNS server in Kubernetes, responsible for Service Discovery. Pods can discover Services using DNS names like `my-service.my-namespace.svc.cluster.local` (fully qualified), `my-service.my-namespace` (within the same cluster), or `my-service` (within the same namespace). Each Pod gets its own DNS configuration, inheriting from the cluster's CoreDNS.