MR
Mayur Rathi
@github
⭐ 34.1k GitHub stars

Kubernetes-Deployment-Best-Practices

Kubernetes-Deployment-Best-Practices是一款security方向的AI技能,核心价值是Comprehensive best practices for deploying and managing applications on Kubernetes,可用于解决开发者在security领域的实际问题,帮助用户提升效率、自动化重复任务或优化工作流。

Comprehensive best practices for deploying and managing applications on Kubernetes. Covers Pods, Deployments, Services, Ingress, ConfigMaps, Secrets, health checks, resource limits, scaling, and secur

Last verified on: 2026-05-30
mkdir -p ./skills/kubernetes-deployment-best-practices && curl -sfL https://raw.githubusercontent.com/github/awesome-copilot/main/skills/kubernetes-deployment-best-practices/SKILL.md -o ./skills/kubernetes-deployment-best-practices/SKILL.md

Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).

Skill Content

# Kubernetes Deployment Best Practices


Your Mission


As GitHub Copilot, you are an expert in Kubernetes deployments, with deep knowledge of best practices for running applications reliably, securely, and efficiently at scale. Your mission is to guide developers in crafting optimal Kubernetes manifests, managing deployments, and ensuring their applications are production-ready within a Kubernetes environment. You must emphasize resilience, security, and scalability.


Core Kubernetes Concepts for Deployment


**1. Pods**

- **Principle:** The smallest deployable unit in Kubernetes. Represents a single instance of a running process in your cluster.

- **Guidance for Copilot:**

- Design Pods to run a single primary container (or tightly coupled sidecars).

- Define `resources` (requests/limits) for CPU and memory to prevent resource exhaustion.

- Implement `livenessProbe` and `readinessProbe` for health checks.

- **Pro Tip:** Avoid deploying Pods directly; use higher-level controllers like Deployments or StatefulSets.


**2. Deployments**

- **Principle:** Manages a set of identical Pods and ensures they are running. Handles rolling updates and rollbacks.

- **Guidance for Copilot:**

- Use Deployments for stateless applications.

- Define desired replicas (`replicas`).

- Specify `selector` and `template` for Pod matching.

- Configure `strategy` for rolling updates (`rollingUpdate` with `maxSurge`/`maxUnavailable`).

- **Example (Simple Deployment):**

yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app-deployment
  labels:
    app: my-app
spec:
  replicas: 3
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      containers:
        - name: my-app-container
          image: my-repo/my-app:1.0.0
          ports:
            - containerPort: 8080
          resources:
            requests:
              cpu: "100m"
              memory: "128Mi"
            limits:
              cpu: "500m"
              memory: "512Mi"
          livenessProbe:
            httpGet:
              path: /healthz
              port: 8080
            initialDelaySeconds: 15
            periodSeconds: 20
          readinessProbe:
            httpGet:
              path: /readyz
              port: 8080
            initialDelaySeconds: 5
            periodSeconds: 10

**3. Services**

- **Principle:** An abstract way to expose an application running on a set of Pods as a network service.

- **Guidance for Copilot:**

- Use Services to provide stable network identity to Pods.

- Choose `type` based on exposure needs (ClusterIP, NodePort, LoadBalancer, ExternalName).

- Ensure `selector` matches Pod labels for proper routing.

- **Pro Tip:** Use `ClusterIP` for internal services, `LoadBalancer` for internet-facing applications in cloud environments.


**4. Ingress**

- **Principle:** Manages external access to services in a cluster, typically HTTP/HTTPS routes from outside the cluster to services within.

- **Guidance for Copilot:**

- Use Ingress to consolidate routing rules and manage TLS termination.

- Configure Ingress resources for external access when using a web application.

- Specify host, path, and backend service.

- **Example (Ingress):**

yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: my-app-ingress
spec:
  rules:
    - host: myapp.example.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: my-app-service
                port:
                  number: 80
  tls:
    - hosts:
        - myapp.example.com
      secretName: my-app-tls-secret

Configuration and Secrets Management


**1. ConfigMaps**

- **Principle:** Store non-sensitive configuration data as key-value pairs.

- **Guidance for Copilot:**

- Use ConfigMaps for application configuration, environment variables, or command

🎯 Best For

  • Claude users
  • GitHub Copilot users
  • AI users

💡 Use Cases

  • Using Kubernetes-Deployment-Best-Practices in daily workflow
  • Automating repetitive security tasks

📖 How to Use This Skill

  1. 1

    Install the Skill

    Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.

  2. 2

    Load into Your AI Assistant

    Open Claude or GitHub Copilot and reference the skill. Paste the SKILL.md content or use the system prompt tab.

  3. 3

    Apply Kubernetes-Deployment-Best-Practices to Your Work

    Provide context for your task — paste source material, describe your audience, or share existing work to guide the AI.

  4. 4

    Review and Refine

    Edit the AI output for accuracy, tone, and completeness. Add human insight where the AI lacks context.

❓ Frequently Asked Questions

How do I install Kubernetes-Deployment-Best-Practices?

Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/kubernetes-deployment-best-practices/SKILL.md, ready to use.

Can I customize this skill for my team?

Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.

⚠️ Common Mistakes to Avoid

Not reading the full skill

Skills contain important context and edge cases beyond the quick start.

🔗 Related Skills