Search⌘ K

Introspecting Services and Endpoint Objects

Explore how to introspect Kubernetes Services and EndpointSlice objects using standard kubectl commands. Understand how Services expose Pods via IP addresses and ports, how EndpointSlices track Pods, and how to manage these resources in different cluster environments.

Run the following widget and use it to execute all the commands in this lesson.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: svc-test
spec:
  replicas: 10
  selector:
    matchLabels:
      chapter: services
  template:
    metadata:
      labels:
        chapter: services
    spec:
      containers:
      - name: hello-ctr
        image: nigelpoulton/k8sbook:1.0
        ports:
        - containerPort: 8080
Playground

Inspecting Services

Services are regular API resources, and we can inspect them with the usual kubectl get and kubectl describe commands.

$ kubectl get svc cloud-lb
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
cloud-lb LoadBalancer 10.43.191.202 212.2.247.202 9000:30202/TCP 1m ago
Check the status of the Service

The output will show <pending> in the ...