Self-Hosted Deployment with kubectl: Complete Guide
The node was silent, waiting for orders. You hold the keys. One command and your self-hosted deployment comes alive.
Running kubectl for self-hosted deployment is direct, fast, and under your control. No dependency on external platforms. Your cluster is yours. The process is simple, but precision matters.
First, configure your kubeconfig to point to the correct cluster. If your cluster is on bare metal, inside a private cloud, or air-gapped, make sure the API server is reachable from your workstation or CI pipeline. Test connectivity with:
kubectl get nodes
When you see the list, you have a live path.
Prepare your deployment manifest. Define apiVersion, kind: Deployment, metadata, and spec. Set replicas to match your capacity. Include container images from your own registry if isolation is critical. Example:
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 3
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-app-container
image: registry.local/my-app:latest
ports:
- containerPort: 8080
Apply with:
kubectl apply -f deployment.yaml
Verify rollout with:
kubectl rollout status deployment/my-app
For a self-hosted deployment, monitoring is not optional. Use kubectl describe to inspect Pods. Use kubectl logs to capture behavior. Monitor kubectl top nodes and kubectl top pods if metrics-server runs in your cluster. Any error should be addressed immediately to keep uptime.
Security is part of the deployment. Restrict RBAC permissions to operators. Use NetworkPolicies to cut unwanted traffic. Keep your container images updated. In a self-hosted model, you control every change, so automate as much as possible without losing visibility.
Scaling is as simple as:
kubectl scale deployment my-app --replicas=5
Rolling updates and rollbacks are your tools. Keep manifests in version control. Treat every kubectl command as production-impacting.
A self-hosted deployment with kubectl gives speed, ownership, and flexibility. You define the cluster, the deployment, and the lifecycle. Every Pod runs on your infrastructure. Every byte moves inside your walls.
Want to see powerful self-hosted deployments run live in minutes? Try it now at hoop.dev.