liveBook · Manning

Kubectl

As explained in Quarkus in Action

kubectl is the command-line client for interacting with Kubernetes clusters and their resources.

kubectl applies Kubernetes manifests and inspects the resulting workloads. A Quarkus build generates YAML resources for an Inventory service, which kubectl submits to the cluster. section 11.3.3

A practical deployment loop is:

  • Generate Kubernetes YAML with the Quarkus Kubernetes extension and build the service. section 11.3.3
  • Apply the generated file with kubectl apply -f inventory-service/target/kubernetes/kubernetes.yml. section 11.3.3
  • Check workload readiness with kubectl get pods. section 11.3.3
  • Reach a running service locally with kubectl port-forward. section 11.3.3

Apply and verify an Inventory deployment

kubectl apply -f inventory-service/target/kubernetes/kubernetes.yml creates the MySQL and Inventory services and deployments. kubectl get pods confirms that both pods are Running, while kubectl port-forward inventory-service-77f997bf47-4d5hf 8083:8083 forwards local port 8083. section 11.3.3

Listing 11.13 Applying generated Kubernetes manifest
$ kubectl apply -f inventory-service/target/kubernetes/kubernetes.yml
service/mysql created
service/inventory-service created
deployment.apps/mysql created
deployment.apps/inventory-service created

$ kubectl get pods                           #1
NAME                                 READY   STATUS    RESTARTS      AGE
inventory-service-77f997bf47-4d5hf   1/1     Running   1 (68s ago)   72s
mysql-58664f58fc-zr2v9               1/1     Running   0             72s

$ kubectl port-forward inventory-service-77f997bf47-4d5hf 8083:8083
Forwarding from 127.0.0.1:8083 -> 8083

Browse the complete command sequence and representative Kubernetes output. section 11.3.3

How Quarkus in Action covers it

How deep it goes
Demonstrates applying generated YAML, listing pods, and forwarding a service port, but omits cluster setup.
Examples
Uses generated kubernetes.yml, kubectl apply, kubectl get pods, and kubectl port-forward against the Inventory service.
What it assumes
Assumes a Kubernetes cluster and generated manifests; leaves cluster setup and kubectl installation outside the treatment.
What you can do after
Operate/configure a Kubernetes deployment by applying manifests, checking pod status, and forwarding a service port.
How it connects
Connects Kubernetes manifests with Services, Deployments, pods, Quarkus, MySQL, and Prometheus ServiceMonitor resources.

Also explained in

Compare how 11 books explain kubectl →

Related concepts

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