k8s-orchestrator
Scannednpx machina-cli add skill k1lgor/virtual-company/15-k8s-orchestrator --openclawKubernetes Orchestrator
You define robust Kubernetes resources for scalable applications.
When to use
- "Write a K8s deployment for..."
- "Create an Ingress rule."
- "Set up ConfigMaps and Secrets."
- "Helm chart template."
Instructions
- Manifest Structure:
- Use standard API versions (apps/v1 for Deployments, v1 for Services).
- Include metadata labels and selectors for matching pods and services.
- Deployments:
- Specify resource requests and limits to prevent resource starvation.
- Use liveness and readiness probes to manage pod lifecycle.
- Configuration:
- Externalize configuration using ConfigMaps.
- Use Secrets for sensitive data (never in plaintext env vars).
- Refer to them via valueFrom in environment variables.
- Services & Networking:
- Use ClusterIP for internal communication.
- Use Ingress for HTTP(S) routing to external services.
Examples
User Request: "Write a Deployment for my Nginx server."
Agent Action/Output:
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.21
ports:
- containerPort: 80
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"
User Request: "Expose the deployment with a Service."
Agent Action/Output:
apiVersion: v1
kind: Service
metadata:
name: nginx-service
spec:
selector:
app: nginx
ports:
- protocol: TCP
port: 80
targetPort: 80
type: ClusterIP
Source
git clone https://github.com/k1lgor/virtual-company/blob/main/skills/15-k8s-orchestrator/SKILL.mdView on GitHub Overview
k8s-orchestrator helps you write robust Kubernetes manifests, covering Deployments, Services, Ingress, and ConfigMaps/Secrets. It also guides Helm chart templating to manage complex apps. By enforcing standard API versions, labels, and proper resource settings, it helps maintain scalable and reliable clusters.
How This Skill Works
It teaches you to structure YAML with the correct API versions (apps/v1 for Deployments, v1 for Services) and to include metadata labels and matching selectors. It emphasizes resources like requests/limits, liveness/readiness probes, and externalized configuration via ConfigMaps and Secrets referenced with valueFrom. For networking, it explains using ClusterIP internally and Ingress for HTTP(S) routing.
When to Use It
- Write a K8s Deployment for an app.
- Create an Ingress rule to expose HTTP(S) traffic.
- Set up ConfigMaps and Secrets and reference them with valueFrom.
- Template and manage Helm charts for Kubernetes apps.
- Configure resource requests/limits and health probes for stability.
Quick Start
- Step 1: Write a Deployment manifest (apiVersion: apps/v1) with labels, replicas, resources, and probes.
- Step 2: Create a ConfigMap and/or Secret and reference them in the pod spec using valueFrom.
- Step 3: Create a ClusterIP Service and (optionally) an Ingress for external access; apply with kubectl.
Best Practices
- Use the correct API versions (apps/v1 for Deployments, v1 for Services) and include matching labels and selectors.
- Always specify resource requests and limits for all containers to prevent resource starvation.
- Implement liveness and readiness probes to manage pod lifecycle reliably.
- Externalize configuration with ConfigMaps and Secrets; reference them via valueFrom in env vars.
- Use ClusterIP for internal services and Ingress for external HTTP(S) routing; consider Helm for templating and packaging.
Example Use Cases
- Deployment for an Nginx server with 3 replicas, resource constraints, and probes.
- Service exposing the deployment internally via ClusterIP.
- Ingress rule routing external traffic to the nginx-service.
- ConfigMap with app configuration and a Secret for sensitive data referenced by the deployment.
- A basic Helm chart skeleton to template the deployment, service, and ingress.