liveBook · Manning

Kubectl get services

As explained in Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform

A kubectl command that displays information about Kubernetes Services, including their assigned external addresses.

Use kubectl get services to inspect Kubernetes Services after deployment. The output shows service type, cluster address, external address, and exposed ports, giving you the endpoint needed to test a microservice. section 6.11.6 section 10.8.3

Use the output according to where the service is running:

  • For a local NodePort deployment, find the assigned port and open http://localhost:<port-number>. section 10.8.3 section 6.8.6
  • For a production LoadBalancer deployment, find EXTERNAL-IP and open the required application route, such as /video. section 6.11.6 section 10.9.3
  • Run it with kubectl get pods and kubectl get deployments to verify that the deployed Kubernetes resources are present and operational. section 7.12 section 10.8.3

Find an external service address

Run kubectl get services and locate the video-streaming row. A LoadBalancer service can show an EXTERNAL-IP such as 20.127.176.147 and expose port 80; use that address with the service's required route to test streaming. section 6.11.6

NAME             TYPE          CLUSTER-IP    EXTERNAL-IP     PORT(S)
kubernetes       ClusterIP     10.0.0.1      <none>          443/TCP
video-streaming  LoadBalancer  10.0.221.252  20.127.176.147  80:32545/TCP

Inspect a representative service listing showing NAME, TYPE, CLUSTER-IP, EXTERNAL-IP, and PORT(S). section 6.11.6

How Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform covers it

How deep it goes
Shows service type, cluster and external addresses, and ports, then stops short of deeper microservice debugging.
Examples
Uses local NodePort access, production gateway access, and a video-streaming LoadBalancer with an external IP.
What it assumes
Assumes a deployed microservice and Kubernetes cluster, while teaching how to locate its reachable service endpoint.
What you can do after
Operate Kubernetes deployments by locating NodePort or external IP values and testing the exposed application route.
How it connects
Connects Kubernetes Services with pods, deployments, NodePort, LoadBalancer, and microservice endpoint testing.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform. The section links point to the parts of the book it draws on.