Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 08:19:47 +08:00
commit ff6c9a6df4
14 changed files with 582 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
{
"name": "kubernetes-deployment-creator",
"description": "Create Kubernetes deployments, services, and configurations with best practices",
"version": "1.0.0",
"author": {
"name": "Claude Code Plugins",
"email": "[email protected]"
},
"skills": [
"./skills"
],
"commands": [
"./commands"
]
}

3
README.md Normal file
View File

@@ -0,0 +1,3 @@
# kubernetes-deployment-creator
Create Kubernetes deployments, services, and configurations with best practices

170
commands/k8s-deploy.md Normal file
View File

@@ -0,0 +1,170 @@
---
description: Create Kubernetes deployments and services
---
# Kubernetes Deployment Creator
Generate production-ready Kubernetes manifests with best practices.
## K8s Resources Generated
1. **Deployment**: Application pods with replicas
2. **Service**: Load balancing and discovery
3. **ConfigMap**: Configuration management
4. **Secret**: Sensitive data storage
5. **Ingress**: External access routing
6. **HPA**: Horizontal pod autoscaling
## Example Deployment (Full Stack App)
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: web-app
namespace: production
labels:
app: web-app
version: v1
spec:
replicas: 3
selector:
matchLabels:
app: web-app
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
template:
metadata:
labels:
app: web-app
version: v1
spec:
containers:
- name: web
image: myapp:1.0.0
ports:
- containerPort: 8080
name: http
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: db-credentials
key: url
- name: REDIS_HOST
valueFrom:
configMapKeyRef:
name: app-config
key: redis-host
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /ready
port: 8080
initialDelaySeconds: 5
periodSeconds: 5
volumeMounts:
- name: config
mountPath: /app/config
readOnly: true
volumes:
- name: config
configMap:
name: app-config
---
apiVersion: v1
kind: Service
metadata:
name: web-app-service
namespace: production
spec:
type: ClusterIP
selector:
app: web-app
ports:
- port: 80
targetPort: 8080
name: http
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: web-app-ingress
namespace: production
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
nginx.ingress.kubernetes.io/rate-limit: "100"
spec:
ingressClassName: nginx
tls:
- hosts:
- app.example.com
secretName: app-tls
rules:
- host: app.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: web-app-service
port:
number: 80
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: web-app-hpa
namespace: production
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: web-app
minReplicas: 3
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80
```
## Best Practices Included
- Resource requests and limits
- Health checks (liveness/readiness)
- Rolling update strategy
- Horizontal pod autoscaling
- ConfigMaps and Secrets
- Ingress with TLS
- Network policies
- Pod disruption budgets
## When Invoked
Generate complete Kubernetes manifests for deploying applications with production-grade configurations.

85
plugin.lock.json Normal file
View File

@@ -0,0 +1,85 @@
{
"$schema": "internal://schemas/plugin.lock.v1.json",
"pluginId": "gh:jeremylongshore/claude-code-plugins-plus:plugins/devops/kubernetes-deployment-creator",
"normalized": {
"repo": null,
"ref": "refs/tags/v20251128.0",
"commit": "0f63daa029e1481c1e47419a145eae9de39005a2",
"treeHash": "2fe19e00479119e64efe00877054efec1494115c627cdee97587bb62ac7c7f63",
"generatedAt": "2025-11-28T10:18:31.582931Z",
"toolVersion": "publish_plugins.py@0.2.0"
},
"origin": {
"remote": "git@github.com:zhongweili/42plugin-data.git",
"branch": "master",
"commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390",
"repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data"
},
"manifest": {
"name": "kubernetes-deployment-creator",
"description": "Create Kubernetes deployments, services, and configurations with best practices",
"version": "1.0.0"
},
"content": {
"files": [
{
"path": "README.md",
"sha256": "565e51804fc4bd89a9f540abaaa5215ba49ccd6320467b591e00623df445a1e5"
},
{
"path": ".claude-plugin/plugin.json",
"sha256": "c6bb3529aab805f0033166869d6f82461643d10d46bc21897ce98f346b1c6e46"
},
{
"path": "commands/k8s-deploy.md",
"sha256": "fbcc4c842223705ac25f9bf49476e92c85eaaa3a49d33641ebf7b0286e722663"
},
{
"path": "skills/kubernetes-deployment-creator/SKILL.md",
"sha256": "07dd15b89390fccd8f778f5ab67ccd0e0e45eec577b2c9fc1b1da6553ed3152a"
},
{
"path": "skills/kubernetes-deployment-creator/references/README.md",
"sha256": "b9a9c48c35d25359881aef2d47b7dace909b96a69455e7a585b3c9feca72cea1"
},
{
"path": "skills/kubernetes-deployment-creator/scripts/README.md",
"sha256": "03eede2db5082d7266518f5aa85cf1d381e18ebe89e52ae32399cb4d26c2d0d0"
},
{
"path": "skills/kubernetes-deployment-creator/assets/configmap_template.yaml",
"sha256": "ad6d9df89a5d36875f0b160b30d031c43b2444f057f93adb4ca971e6c89ef0eb"
},
{
"path": "skills/kubernetes-deployment-creator/assets/service_template.yaml",
"sha256": "7ab8fabb0e0f4d08ea6334db4a7ed513d45a17df7d41860b99b84ac07729b78c"
},
{
"path": "skills/kubernetes-deployment-creator/assets/README.md",
"sha256": "62bffd91aa844eca2b71048238b4d668987fd08c8f5d5ad924ee58f2bf9955dd"
},
{
"path": "skills/kubernetes-deployment-creator/assets/secret_template.yaml",
"sha256": "20439d22f27828407cac17f5d0cae7b876438855d498944eb9043bc70fcdea47"
},
{
"path": "skills/kubernetes-deployment-creator/assets/hpa_template.yaml",
"sha256": "8825a2d3e5887d4d8e94fbf41118defcdabff0288d48c187832445962462d96e"
},
{
"path": "skills/kubernetes-deployment-creator/assets/deployment_template.yaml",
"sha256": "6ed588f2f401114d59bf8a2286fe796849ed888d3ae7aaa816fec4c3c1158366"
},
{
"path": "skills/kubernetes-deployment-creator/assets/ingress_template.yaml",
"sha256": "10626ed5c3e2fbf1482079607dd1ffa113307dd476710b385ba5a73f3f71d2db"
}
],
"dirSha256": "2fe19e00479119e64efe00877054efec1494115c627cdee97587bb62ac7c7f63"
},
"security": {
"scannedAt": null,
"scannerVersion": null,
"flags": []
}
}

View File

@@ -0,0 +1,52 @@
---
name: creating-kubernetes-deployments
description: |
This skill enables Claude to generate Kubernetes deployment manifests, services, and related configurations following best practices. It should be used when the user asks to create a new Kubernetes deployment, service, ingress, or other related resources. Claude will generate YAML files for Deployments, Services, ConfigMaps, Secrets, Ingress, and Horizontal Pod Autoscalers. Use this skill when the user mentions "Kubernetes deployment", "K8s deployment", "create service", "define ingress", or asks for a manifest for any K8s resource.
allowed-tools: Read, Write, Edit, Grep, Glob, Bash
version: 1.0.0
---
## Overview
This skill allows Claude to create production-ready Kubernetes deployments and services. It generates complete K8s manifests with health checks, auto-scaling, ingress, TLS, and resource management configured.
## How It Works
1. **Receiving Request**: Claude receives a request to create Kubernetes resources.
2. **Generating Manifests**: Claude generates YAML manifests for deployments, services, configmaps, secrets, ingress, and horizontal pod autoscalers based on the user's requirements.
3. **Presenting Manifests**: Claude presents the generated manifests to the user for review and deployment.
## When to Use This Skill
This skill activates when you need to:
- Create a new Kubernetes deployment.
- Define a Kubernetes service for an application.
- Generate Kubernetes manifests for any K8s resource.
## Examples
### Example 1: Deploying a Web Application
User request: "Create a Kubernetes deployment for a web application named 'my-web-app' with 3 replicas, exposing port 80."
The skill will:
1. Generate a Deployment manifest for 'my-web-app' with 3 replicas.
2. Generate a Service manifest to expose port 80 of the deployment.
### Example 2: Setting up Ingress for a Service
User request: "Set up an Ingress resource to route traffic to the 'my-web-app' service."
The skill will:
1. Generate an Ingress manifest to route external traffic to the 'my-web-app' service.
2. Configure TLS termination for secure access.
## Best Practices
- **Resource Limits**: Define resource requests and limits for each container to ensure fair resource allocation.
- **Health Checks**: Configure liveness and readiness probes to enable automatic restarts and prevent traffic from being routed to unhealthy pods.
- **Namespaces**: Use namespaces to isolate different environments or applications within the cluster.
## Integration
This skill can be used with other Claude Code plugins for tasks such as deploying infrastructure-as-code (IaC) or integrating with CI/CD pipelines. It provides the Kubernetes manifests that other plugins can then deploy or manage.

View File

@@ -0,0 +1,10 @@
# Assets
Bundled resources for kubernetes-deployment-creator skill
- [ ] deployment_template.yaml: A template for a basic Kubernetes deployment manifest.
- [ ] service_template.yaml: A template for a basic Kubernetes service manifest.
- [ ] ingress_template.yaml: A template for a basic Kubernetes ingress manifest.
- [ ] hpa_template.yaml: A template for a basic Kubernetes Horizontal Pod Autoscaler manifest.
- [ ] configmap_template.yaml: A template for a basic Kubernetes ConfigMap manifest.
- [ ] secret_template.yaml: A template for a basic Kubernetes Secret manifest.

View File

@@ -0,0 +1,33 @@
# Kubernetes ConfigMap Template
# This ConfigMap stores configuration data that can be consumed by pods.
apiVersion: v1
kind: ConfigMap
metadata:
name: REPLACE_ME-config # Replace with your ConfigMap name (e.g., myapp-config)
namespace: default # Optional: Specify the namespace (e.g., production, staging)
labels:
app: REPLACE_ME # Replace with your application name (e.g., myapp)
tier: backend # Optional: Tier or component of the application
data:
# Define your configuration key-value pairs here.
# These values can be accessed by your application running in the pod.
# Example: Application settings
APP_ENVIRONMENT: "production" # or "staging", "development"
LOG_LEVEL: "INFO" # or "DEBUG", "WARNING", "ERROR"
# Example: Database connection details
DATABASE_HOST: "YOUR_VALUE_HERE" # Replace with your database hostname/IP address
DATABASE_PORT: "5432" # Replace with your database port
DATABASE_NAME: "YOUR_VALUE_HERE" # Replace with your database name
DATABASE_USER: "YOUR_VALUE_HERE" # Replace with your database username
# Example: Feature flags (boolean values as strings)
ENABLE_NEW_FEATURE: "true" # or "false"
# Example: API endpoint
API_ENDPOINT: "https://api.example.com" # Replace with your API endpoint
# Add more configuration entries as needed. Remember to quote values that might be interpreted as numbers or booleans if you want them to be strings.

View File

@@ -0,0 +1,58 @@
# deployment_template.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: REPLACE_ME-deployment
labels:
app: REPLACE_ME
spec:
replicas: 3 # Number of desired pods
selector:
matchLabels:
app: REPLACE_ME
strategy:
type: RollingUpdate # Use rolling updates for zero-downtime deployments
rollingUpdate:
maxSurge: 25% # Allow up to 25% more pods than desired during update
maxUnavailable: 25% # Ensure at least 75% of pods are available during update
template:
metadata:
labels:
app: REPLACE_ME
spec:
containers:
- name: REPLACE_ME-container
image: YOUR_VALUE_HERE # Replace with your container image
imagePullPolicy: IfNotPresent # Only pull the image if it's not present
ports:
- containerPort: 80 # The port your application listens on
name: http
protocol: TCP
resources: # Define resource requests and limits
requests:
cpu: 100m # Minimum CPU required (100 millicores)
memory: 256Mi # Minimum memory required (256 mebibytes)
limits:
cpu: 500m # Maximum CPU allowed (500 millicores)
memory: 512Mi # Maximum memory allowed (512 mebibytes)
livenessProbe: # Check if the container is running
httpGet:
path: /healthz # Replace with your health check endpoint
port: 80
initialDelaySeconds: 30 # Wait 30 seconds after container starts
periodSeconds: 10 # Check every 10 seconds
timeoutSeconds: 5 # Timeout after 5 seconds
failureThreshold: 3 # Retry 3 times before considering the container unhealthy
readinessProbe: # Check if the container is ready to serve traffic
httpGet:
path: /readyz # Replace with your readiness check endpoint
port: 80
initialDelaySeconds: 15 # Wait 15 seconds after container starts
periodSeconds: 10 # Check every 10 seconds
timeoutSeconds: 5 # Timeout after 5 seconds
failureThreshold: 3 # Retry 3 times before considering the container not ready
# Add environment variables here if needed
# env:
# - name: MY_ENV_VAR
# value: "YOUR_VALUE_HERE"

View File

@@ -0,0 +1,28 @@
# hpa_template.yaml
# Template for a Kubernetes Horizontal Pod Autoscaler (HPA)
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: REPLACE_ME-hpa # Replace with your HPA name
namespace: YOUR_VALUE_HERE # Replace with your namespace
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: REPLACE_ME # Replace with your deployment name
minReplicas: 2 # Minimum number of replicas
maxReplicas: 10 # Maximum number of replicas
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70 # Target CPU utilization percentage
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80 # Target memory utilization percentage

View File

@@ -0,0 +1,46 @@
# ingress_template.yaml
# This file defines a basic Ingress resource for Kubernetes.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: REPLACE_ME-ingress # Replace with your ingress name
namespace: REPLACE_ME-namespace # Replace with your namespace
annotations:
# Use cert-manager to automatically provision TLS certificates
cert-manager.io/cluster-issuer: letsencrypt-prod # Replace with your cert-manager issuer
# Optional: Configure rate limiting using ingress-nginx (replace with your desired limits)
# nginx.ingress.kubernetes.io/limit-rps: "10"
# nginx.ingress.kubernetes.io/limit-burst: "20"
# Optional: Configure rewrite target if needed
# nginx.ingress.kubernetes.io/rewrite-target: /$1
# Optional: Enable sticky sessions based on cookie
# nginx.ingress.kubernetes.io/affinity: "cookie"
# nginx.ingress.kubernetes.io/session-cookie-name: "ROUTEID"
# nginx.ingress.kubernetes.io/session-cookie-hash: "sha1"
spec:
# Define ingressClassName if using a specific ingress controller (e.g., nginx)
ingressClassName: nginx # Replace with your ingress class name if needed
tls:
# Configure TLS for secure communication
- hosts:
- REPLACE_ME.YOUR_DOMAIN_HERE # Replace with your domain name
secretName: REPLACE_ME-tls # Replace with the name of your TLS secret
rules:
# Define routing rules for incoming traffic
- host: REPLACE_ME.YOUR_DOMAIN_HERE # Replace with your domain name
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: REPLACE_ME-service # Replace with your service name
port:
number: 80 # Replace with your service port

View File

@@ -0,0 +1,41 @@
# This YAML file defines a Kubernetes Secret.
# Secrets are used to store sensitive information, such as passwords, API keys, and tokens.
# It's crucial to handle Secrets securely to protect your application.
apiVersion: v1
kind: Secret
metadata:
name: REPLACE_ME-secret # Replace with a descriptive name for your secret
namespace: default # Consider using a specific namespace for your application
labels:
app: REPLACE_ME-app # Replace with your application name
tier: backend # Optional: Add a tier label if applicable
annotations:
# Optional: Add annotations for documentation or automation
description: "Secret for REPLACE_ME application"
type: Opaque # Use Opaque for generic key-value secrets
data:
# Each key-value pair represents a secret.
# The values should be base64 encoded.
# Example:
# my_password: $(echo -n "mysecretpassword" | base64)
#
# IMPORTANT: Never store plaintext secrets in your YAML file.
# Use a secure method to generate and encode the values.
#
# Example using environment variables:
# my_api_key: $(echo -n "$MY_API_KEY" | base64)
# Add your secrets here:
api_key: YOUR_VALUE_HERE # Replace with your base64 encoded API key
database_password: YOUR_VALUE_HERE # Replace with your base64 encoded database password
# Optional: You can use 'stringData' instead of 'data' to provide plaintext values.
# Kubernetes will automatically encode them to base64.
# However, it's generally recommended to encode the values beforehand for security.
#
# stringData:
# username: myuser
# password: mysecretpassword

View File

@@ -0,0 +1,25 @@
# Kubernetes Service Manifest Template
# This file defines a Kubernetes Service, which exposes your application to the network.
apiVersion: v1
kind: Service
metadata:
name: REPLACE_ME-service # Replace with your service name
namespace: default # Change if you're using a different namespace
labels:
app: REPLACE_ME # Replace with your application name
tier: frontend # Or backend, database, etc.
spec:
type: ClusterIP # Options: ClusterIP, NodePort, LoadBalancer
# ClusterIP: Exposes the service on a cluster-internal IP. Choose this if you only need access from within the cluster.
# NodePort: Exposes the service on each Node's IP at a static port (the NodePort). Choose this for external access during development.
# LoadBalancer: Exposes the service externally using a cloud provider's load balancer. Choose this for production external access.
selector:
app: REPLACE_ME # Must match the labels of your deployment's pods
ports:
- port: 80 # The port the service exposes internally
targetPort: 8080 # The port your application is listening on within the pod
protocol: TCP
name: http # Optional, but helpful for clarity
# sessionAffinity: ClientIP # Uncomment this line to enable session affinity (sticky sessions) based on the client's IP address. Useful for applications that require session persistence.
# externalTrafficPolicy: Cluster # Uncomment for LoadBalancer. Options: Cluster or Local. Local preserves the client source IP.

View File

@@ -0,0 +1,8 @@
# References
Bundled resources for kubernetes-deployment-creator skill
- [ ] kubernetes_api_reference.md: A comprehensive reference to the Kubernetes API, including resource definitions and best practices.
- [ ] kubernetes_deployment_best_practices.md: A guide to best practices for creating Kubernetes deployments, including health checks, resource limits, and auto-scaling.
- [ ] security_best_practices.md: Security best practices for Kubernetes deployments, including network policies, RBAC, and secret management.
- [ ] troubleshooting_guide.md: A troubleshooting guide for common Kubernetes deployment issues.

View File

@@ -0,0 +1,8 @@
# Scripts
Bundled resources for kubernetes-deployment-creator skill
- [ ] validate_manifest.sh: Validates a Kubernetes manifest file against the Kubernetes API schema.
- [ ] apply_manifest.sh: Applies a Kubernetes manifest file to the cluster.
- [ ] delete_manifest.sh: Deletes a Kubernetes manifest file from the cluster.
- [ ] get_resource_status.sh: Retrieves the status of a Kubernetes resource (e.g., deployment, service).