liveBook · Manning

Psql

As explained in Road to Kubernetes

psql is the PostgreSQL interactive command-line client for executing SQL statements and administrative commands.

psql is the PostgreSQL interactive command-line client for executing SQL statements and administrative commands. In Kubernetes, it can test database connectivity without modifying the application. section 8.4.3

A practical Kubernetes testing workflow uses psql to:

  • Provision a temporary, deletable Pod directly with kubectl. section 8.4.3
  • Start from the small debian:bullseye-slim image and keep its container running with sleep infinity. section 8.4.3
  • Install the PostgreSQL client inside the Pod, then run psql to connect to the database from within the cluster. section 8.4.3

Testing from a temporary Pod

When no existing container includes psql, create a disposable Pod instead of building a new image. This supports quick tests of container-to-container communication, ConfigMaps, Secrets, and database connectivity; delete the Pod afterward. section 8.4.3

Figure 8.14 Cross-service communication between Services and psql

Trace how Services expose database endpoints that psql can use for cross-service communication. section 8.4.3

How Road to Kubernetes covers it

How deep it goes
Demonstrates temporary Pod provisioning, client installation, and database connection, while deferring application integration code.
Examples
Uses a debian:bullseye-slim Pod, sleep infinity, kubectl provisioning, and a Docker --rm comparison.
What it assumes
Assumes basic command-line familiarity while introducing temporary Pods and PostgreSQL client installation as needed.
What you can do after
Diagnose/debug with it by testing PostgreSQL access and service communication from inside a Kubernetes cluster.
How it connects
Connects psql with Kubernetes, kubectl, Pods, Services, Docker, ConfigMaps, Secrets, and container-to-container communication.

Also explained in

Compare how 3 books explain psql →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Road to Kubernetes. The section links point to the parts of the book it draws on.