kubectl Basics
This guide assumes the Helm release and namespace are both named flow-like. Replace either name if your installation uses different values; chart resource names are derived from the Helm release.
Confirm the cluster and namespace
Section titled “Confirm the cluster and namespace”kubectl config current-contextkubectl config get-contextskubectl cluster-infokubectl get namespace flow-likeSet the namespace on the current context if you do not want to repeat -n flow-like:
kubectl config set-context --current --namespace=flow-likeThis changes your local kubeconfig context, not the cluster resources.
Inspect the installation
Section titled “Inspect the installation”kubectl get deployment,statefulset,job,cronjob,pod,service,pvc,hpa -n flow-likekubectl get events -n flow-like --sort-by=.lastTimestampWith default chart values, expect:
| Resource | Default form |
|---|---|
| API | Deployment and ClusterIP Service |
| Web app | Deployment and ClusterIP Service |
| Executor pool | Deployment and ClusterIP Service |
| Redis | Single-replica Deployment, Service named flow-like-redis-master, and optional PVC |
| Internal CockroachDB | Single-replica StatefulSet plus headless and public Services |
| Database migration | Job |
| Compiler | Disabled unless configured |
| HPAs | Absent unless autoscaling is enabled |
Use labels when Pod names include generated hashes:
kubectl get pods -n flow-like \ -l app.kubernetes.io/component=api \ -o wideFor details and recent events:
kubectl describe deployment flow-like-api -n flow-likekubectl describe pod <pod-name> -n flow-likekubectl top pods -n flow-like requires the cluster metrics API, commonly provided by Metrics Server.
Port-forward the API
Section titled “Port-forward the API”kubectl port-forward service/flow-like-api 8083:8080 -n flow-likeIn another terminal:
curl -fsS http://localhost:8083/health/readycurl -fsS http://localhost:8083/api/v1/healthThe command parts are:
| Part | Meaning |
|---|---|
service/flow-like-api | Kubernetes resource receiving the forwarded connection |
first 8083 | Local port |
second 8080 | Service port inside the cluster |
-n flow-like | Namespace containing the Service |
The port forward lasts only while the command is running.
Optional operator-only services
Section titled “Optional operator-only services”Forward the internal CockroachDB Admin UI to localhost:
kubectl port-forward service/flow-like-cockroachdb-public 8084:8080 -n flow-likeOpen http://localhost:8084. Keep database and metrics interfaces bound to localhost; do not publish them through an unauthenticated Ingress.
Read logs
Section titled “Read logs”# Recent API logskubectl logs deployment/flow-like-api -n flow-like --tail=100
# Follow API logskubectl logs deployment/flow-like-api -n flow-like --follow
# Logs from a specific Pod and containerkubectl logs <pod-name> -c <container-name> -n flow-like
# Previous container instance after a restartkubectl logs <pod-name> -c <container-name> -n flow-like --previousList container names before selecting one:
kubectl get pod <pod-name> -n flow-like \ -o jsonpath='{.spec.containers[*].name}'Restart or watch a rollout
Section titled “Restart or watch a rollout”kubectl rollout restart deployment/flow-like-api -n flow-likekubectl rollout status deployment/flow-like-api -n flow-likekubectl rollout history deployment/flow-like-api -n flow-likeA rollout restart changes live cluster state and briefly replaces Pods. Check readiness and logs after it completes.
Diagnose an unhealthy Pod
Section titled “Diagnose an unhealthy Pod”kubectl get pods -n flow-likekubectl describe pod <pod-name> -n flow-likekubectl logs <pod-name> -n flow-like --tail=200kubectl logs <pod-name> -n flow-like --previous --tail=200| Status | First checks |
|---|---|
Pending | Scheduling events, resource requests, PVC binding, node selectors |
ImagePullBackOff | Image name/tag, pull policy, registry credentials |
CrashLoopBackOff | Current and previous logs, environment references, probes |
Running but not ready | Readiness probe, dependencies, Service endpoints |
Check which Pods back the API Service:
kubectl get endpointslice -n flow-like \ -l kubernetes.io/service-name=flow-like-apiTest from inside the cluster
Section titled “Test from inside the cluster”kubectl run flow-like-debug \ --image=curlimages/curl \ --restart=Never \ --rm -it \ -n flow-like \ -- shInside the temporary Pod:
curl -fsS http://flow-like-api:8080/health/readycurl -fsS http://flow-like-api:8080/api/v1/health/dbThe Pod is deleted when the interactive session exits.
Inspect configuration safely
Section titled “Inspect configuration safely”List names and metadata:
kubectl get configmap,secret -n flow-likekubectl describe configmap flow-like-sink-config -n flow-likekubectl describe secret flow-like-storage -n flow-likekubectl describe secret shows key names and sizes without printing secret values. Avoid -o yaml, JSONPath decoding, shell tracing, or screenshots when handling production Secrets.
Check which environment sources the API Pod references without resolving their values:
kubectl get deployment flow-like-api -n flow-like \ -o jsonpath='{.spec.template.spec.containers[0].envFrom[*].secretRef.name}'Scale the API
Section titled “Scale the API”When api.autoscaling.enabled=false:
kubectl scale deployment/flow-like-api --replicas=3 -n flow-likekubectl rollout status deployment/flow-like-api -n flow-likeManual scale changes can be overwritten by a later Helm upgrade. Record the intended count in api.replicaCount.
When autoscaling is enabled:
kubectl get hpa flow-like-api -n flow-likekubectl describe hpa flow-like-api -n flow-likeLet the HPA own the replica count and adjust the chart’s autoscaling values instead of repeatedly using kubectl scale.
Helm operations
Section titled “Helm operations”From the repository root:
# Inspect the installed releasehelm status flow-like -n flow-likehelm get values flow-like -n flow-likehelm history flow-like -n flow-like
# Apply checked-in chart changes and your private valueshelm upgrade --install flow-like apps/backend/kubernetes/helm \ -n flow-like \ --create-namespace \ -f values.yaml
# Roll back to a known revisionhelm rollback flow-like <revision> -n flow-likeKeep credentials in an existing Secret or an ignored secrets-values file. Review rendered changes before applying them to a production cluster.
Quick reference
Section titled “Quick reference”| Task | Command |
|---|---|
| List workloads | kubectl get deploy,sts,job,cronjob,pod -n flow-like |
| Recent events | kubectl get events -n flow-like --sort-by=.lastTimestamp |
| API logs | kubectl logs deploy/flow-like-api -n flow-like --tail=100 |
| API port forward | kubectl port-forward svc/flow-like-api 8083:8080 -n flow-like |
| API rollout | kubectl rollout status deploy/flow-like-api -n flow-like |
| Describe a Pod | kubectl describe pod <pod-name> -n flow-like |
| List Service backends | kubectl get endpointslice -n flow-like |