Environment:A5c ai Babysitter kubectl CLI
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, Deployment |
| Last Updated | 2026-10-23 00:00 GMT |
Overview
kubectl CLI environment for inspecting Kubernetes resource status after Kradle deployment.
Description
This environment provides the kubectl CLI required by the Kradle installer to query the status of deployed Kubernetes resources after installation. The installer runs `kubectl get deploy,svc,ingress,pvc` in the target namespace to report resource readiness. When kubectl is not available, the installer gracefully returns an empty resource list rather than failing. For existing clusters, a custom kube-context can be specified.
Usage
Use this environment for the environment installation workflow to verify deployed resource status and for any operation that inspects live Kubernetes resources. It is the mandatory prerequisite for the `install_environment` implementation's status verification step.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux / macOS | CI runners |
| Hardware | 1 CPU core, 1GB RAM | Sufficient for kubectl operations |
| Network | Kubernetes API access | Required for resource queries |
Dependencies
System Packages
- `kubectl` >= 1.27.0
- Kubernetes cluster access (kubeconfig)
Credentials
- Kubernetes kubeconfig at `~/.kube/config` or `KUBECONFIG` environment variable
- Custom kube-context for existing clusters (configured via `target.kubeContext`)
Quick Install
# Install kubectl
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl && sudo mv kubectl /usr/local/bin/
# Verify installation
kubectl version --client
# The installer will query resource status automatically
node packages/kradle/installer/dist/cli.js status --env staging
Code Evidence
kubectl existence check and status query from `packages/kradle/installer/src/sdk/deploy.ts:138-160`:
export async function getEnvironmentStatus(config: CloudConfig): Promise<EnvironmentStatus> {
const commands = [
`kubectl get deploy,svc,ingress,pvc -n ${config.namespace} -o json`,
];
if (!(await commandExists("kubectl"))) {
return {
namespace: config.namespace,
resources: [],
commands,
};
}
const args = ["get", "deploy,svc,ingress,pvc", "-n", config.namespace, "-o", "json"];
if (config.target.type === "existing") {
args.push("--context", config.target.kubeContext);
}
const result = await execCommand("kubectl", args);
return {
namespace: config.namespace,
resources: parseResources(result.stdout),
commands,
};
}
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `command -v kubectl` exits non-zero | kubectl not installed | Install kubectl; the installer will return empty status instead of failing |
| `The connection to the server was refused` | kubeconfig not configured or cluster not running | Set up kubeconfig or start minikube |
| `context "X" does not exist` | Invalid kube-context specified | Verify the context name in kubeconfig |
Compatibility Notes
- Graceful degradation: When kubectl is not found, the installer returns an empty resource list rather than throwing — this allows render-only workflows to proceed.
- Existing clusters: Use `--context` flag via `target.kubeContext` in cloud config.
- In-cluster: Service account credentials are used automatically when running inside Kubernetes.