Index of every page on this site: llms.txt
All skills
jyasuu avatar

/kubernetes

@d3e2684
Run it yourself

Kubernetes cluster management commands including pods, services, deployments, debugging, and resource operations.

  • 1 file
  • 4.3 KB
  • Updated 10 months ago
  • GitHub
Use this Skill: https://skilld.dev/gh/jyasuu/cheat-sheet/kubernetes

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

โ‰ˆ31 tokens for metadata: the name and description. โ‰ˆ1.1k when used: this file.

Description uses 1.6% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses โ‰ˆ126 characters, or 1.6%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Kubernetes โ€” Common Commands

Basic Operations

# Create namespace
kubectl create ns demo-ns

# Run pod
kubectl run whoami --image=traefik/whoami -n demo-ns

# Expose pod as service
kubectl expose pod whoami --type=NodePort --port=80 --name=whoami-svc -n demo-ns

# Get resources with details
kubectl get pods -n demo-ns -o wide
kubectl get svc -n demo-ns -o wide

# List all resources in all namespaces
kubectl get all -A

# Show cluster info
kubectl cluster-info

Debugging

# Run temporary debug pod
kubectl run -n demo-ns -it --rm --image=curlimages/curl:8.1.2 curly -- /bin/sh

# Exec into pod
kubectl exec -n demo-ns -it whoami -- /bin/bash

# Print logs
kubectl logs pod_name

# Run command in pod
kubectl exec pod_name -- ls /

# Resource usage
kubectl top pod|node

# Order events by timestamp
kubectl get events --sort-by='.metadata.creationTimestamp'

Labels & Annotations

# Add label to pod
kubectl label pods name unhealthy=true

# Explain resource fields
kubectl explain pods.spec.containers

Context & Configuration

# Switch context
kubectl config use-context CONTEXT_NAME

# Autocomplete in bash
source <(kubectl completion bash)

# List global options
kubectl options

Other Useful

kubectl get resourcequota -n demo-ns
kubectl get deploy -n demo-ns
kubectl get rs -n demo-ns
kubectl get po -n demo-ns
kubectl get services -n demo-ns
kubectl get ingresses -n demo-ns
kubectl describe service whoami-svc -n demo-ns
kubectl rollout restart deployment.apps/spring-boot-app -n demo-ns

# Delete namespace stuck in terminating state
(
NAMESPACE=your-rogue-namespace
kubectl proxy &
kubectl get namespace $NAMESPACE -o json |jq '.spec = {"finalizers":[]}' >temp.json
curl -k -H "Content-Type: application/json" -X PUT --data-binary @temp.json 127.0.0.1:8001/api/v1/namespaces/$NAMESPACE/finalize
)

# Install Gateway API CRDs
kubectl get crd gateways.gateway.networking.k8s.io &> /dev/null || \
  kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.3.0/standard-install.yaml

# Create docker registry secret
kubectl create secret docker-registry gitlab-registry --docker-server=https://docker.io --docker-username=jyasu --docker-password=jyasu --docker-email=jyasu@example.com --dry-run=client -o yaml

Cleanup

kubectl delete svc whoami-svc -n demo-ns
kubectl delete pod whoami -n demo-ns
kubectl delete pod curly -n demo-ns

Manifest Templates

# --- Deployment ---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: <app-name>
spec:
  replicas: 1
  revisionHistoryLimit: 3
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: <app-name>
  template:
    metadata:
      labels:
        app: <app-name>
    spec:
      containers:
      - name: <container-name>
        image: <registry>/<repo>:<tag>
        ports:
        - containerPort: <port>
        imagePullPolicy: IfNotPresent
        volumeMounts:
        - name: <volume-name>
          mountPath: /data
        env:
        - name: TZ
          value: Asia/Taipei
        envFrom:
        - configMapRef:
            name: <configmap-name>
        resources:
          requests:
            cpu: "100m"
            memory: "128Mi"
          limits:
            cpu: "200m"
            memory: "256Mi"
      volumes:
      - name: <volume-name>
        nfs:
          server: <nfs-server>
          path: <nfs-path>

---
# --- Service ---
apiVersion: v1
kind: Service
metadata:
  name: <svc-name>
spec:
  selector:
    app: <app-name>
  ports:
  - port: <svc-port>
    targetPort: <container-port>
  type: ClusterIP

---
# --- HTTPRoute (Gateway API) ---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: <route-name>
spec:
  parentRefs:
  - name: <gateway-name>
    sectionName: https
    namespace: <gateway-namespace>
  - name: <gateway-name>
    sectionName: http
    namespace: <gateway-namespace>
  hostnames:
  - "<host.example.com>"
  rules:
  - matches:
    - path:
        type: PathPrefix
        value: /
    backendRefs:
    - name: <svc-name>
      port: <svc-port>

๐Ÿ”— Kubernetes Command Reference

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at d3e2684. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last month.

Steadyupdated 10 months ago

README badge

README badge for jyasuu/cheat-sheet/kubernetes