docker-orchestration-knowledge
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "docker-orchestration-knowledge":https://skillpi.com/zh/skills/deepskill-cb00be8acd0f87114d6a2e94c7f1c8da6d343e4d7e797c41a6bb7f4421a2525c。安装前核对上游来源和版本:https://github.com/dykyi-roman/awesome-claude-code。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
Docker 编排知识库。提供适用于 Swarm 和 Kubernetes 的基础知识、服务扩展模式以及针对 PHP 负载均衡的实用模式与建议,作为编排决策参考。
介绍来源: third_party · dykyi-roman · 0.0.1 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: docker-orchestration-knowledge
description: Docker orchestration knowledge base. Provides patterns for Swarm, Kubernetes basics, service scaling, and load balancing for PHP.Docker Orchestration Knowledge Base
Quick reference for container orchestration patterns with PHP applications.
Docker Swarm
Core Concepts
+---------------------------------------------------------------------------+
| DOCKER SWARM ARCHITECTURE |
+---------------------------------------------------------------------------+
| |
| Manager Nodes (Raft consensus) |
| +--------------------------------------------------------------------+ |
| | Schedule tasks | Maintain state | Serve API | Manage secrets | |
| +--------------------------------------------------------------------+ |
| | | | |
| v v v |
| Worker Nodes |
| +----------------+ +----------------+ +----------------+ |
| | Task: php (1) | | Task: php (2) | | Task: php (3) | |
| | Task: nginx(1) | | Task: nginx(2) | | Task: worker(1)| |
| +----------------+ +----------------+ +----------------+ |
| |
| Overlay Network (encrypted) |
| +--------------------------------------------------------------------+ |
| | Service discovery | Load balancing | DNS resolution | |
| +--------------------------------------------------------------------+ |
| |
+---------------------------------------------------------------------------+
Stack Deployment
# docker-stack.yml
version: "3.8"
services:
nginx:
image: myregistry/nginx:latest
ports:
- "80:80"
- "443:443"
deploy:
replicas: 2
placement:
constraints:
- node.role == worker
update_config:
parallelism: 1
delay: 10s
networks:
- frontend
- backend
php:
image: myregistry/php-app:latest
deploy:
replicas: 3
resources:
limits:
cpus: '1.0'
memory: 512M
reservations:
cpus: '0.25'
memory: 256M
update_config:
parallelism: 1
delay: 15s
order: start-first
failure_action: rollback
secrets:
- db_password
- app_key
networks:
- backend
postgres:
image: postgres:16-alpine
deploy:
replicas: 1
placement:
constraints:
- node.labels.storage == ssd
volumes:
- db-data:/var/lib/postgresql/data
networks:
- backend
networks:
frontend:
driver: overlay
backend:
driver: overlay
internal: true
volumes:
db-data:
driver: local
secrets:
db_password:
external: true
app_key:
external: true
# Deploy stack
docker stack deploy -c docker-stack.yml myapp
# Scale service
docker service scale myapp_php=5
# Update service image
docker service update --image myregistry/php-app:v2 myapp_php
# Rollback service
docker service rollback myapp_php
Kubernetes Overview
PHP Application Resources
+---------------------------------------------------------------------------+
| KUBERNETES RESOURCES FOR PHP |
+---------------------------------------------------------------------------+
| |
| Ingress --> Service --> Deployment --> Pod |
| (L7 LB) (L4 LB) (Replicas) (Container) |
| |
| ConfigMap Secret HPA PDB |
| (php.ini) (db creds) (Auto-scale) (Disruption budget) |
| |
+---------------------------------------------------------------------------+
Deployment Manifest
apiVersion: apps/v1
kind: Deployment
metadata:
name: php-app
labels:
app: php-app
spec:
replicas: 3
selector:
matchLabels:
app: php-app
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
template:
metadata:
labels:
app: php-app
spec:
containers:
- name: php-fpm
image: myregistry/php-app:latest
ports:
- containerPort: 9000
resources:
requests:
cpu: "250m"
memory: "256Mi"
limits:
cpu: "1000m"
memory: "512Mi"
livenessProbe:
exec:
command: ["php-fpm-healthcheck"]
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
exec:
command: ["php-fpm-healthcheck"]
initialDelaySeconds: 5
periodSeconds: 5
envFrom:
- configMapRef:
name: php-config
volumeMounts:
- name: php-ini
mountPath: /usr/local/etc/php/conf.d/custom.ini
subPath: custom.ini
volumes:
- name: php-ini
configMap:
name: php-ini-config
Horizontal Pod Autoscaler
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: php-app-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: php-app
minReplicas: 3
maxReplicas: 20
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80
Scaling PHP-FPM
Horizontal Scaling
| Factor | Consideration |
|---|---|
| Replicas | Start with 3, scale based on CPU/memory metrics |
| Stateless | No local sessions, use Redis/Memcached |
| Shared storage | Use object storage (S3) for uploads |
| Database | Connection pooling, read replicas |
| Cache | Centralized Redis, not per-container |
FPM Pool Tuning Per Container
; For containers with 512MB memory limit
pm = dynamic
pm.max_children = 15
pm.start_servers = 5
pm.min_spare_servers = 3
pm.max_spare_servers = 10
pm.max_requests = 1000
Formula: max_children = (container_memory - overhead) / avg_process_memory
Load Balancing Patterns
| Pattern | Layer | Tool | Use Case |
|---|---|---|---|
| Round Robin | L4/L7 | Nginx, HAProxy | Default, equal distribution |
| Least Connections | L4 | Nginx, HAProxy | Varying request durations |
| IP Hash | L7 | Nginx | Sticky sessions (avoid if possible) |
| Weighted | L4/L7 | Nginx, HAProxy | Mixed capacity nodes |
Nginx Load Balancer
upstream php-app {
least_conn;
server php-1:9000 weight=3;
server php-2:9000 weight=3;
server php-3:9000 weight=1 backup;
keepalive 32;
}
Service Discovery
| Platform | Mechanism | DNS |
|---|---|---|
| Docker Compose | Built-in DNS | Service name resolves to container IP |
| Docker Swarm | VIP + DNS RR | Service name resolves to virtual IP |
| Kubernetes | ClusterIP Service | service.namespace.svc.cluster.local |
Rolling Updates
Zero-Downtime Deployment Checklist
- [ ] Health checks configured (liveness + readiness)
- [ ] Graceful shutdown handling (SIGTERM/SIGQUIT)
- [ ]
order: start-first(start new before stopping old) - [ ] Connection draining period (stop_grace_period)
- [ ] Database migrations run before deployment
- [ ] Backward-compatible API changes
- [ ] Session persistence via external store
Blue-Green with Docker
# Deploy green alongside blue
docker compose -f docker-compose.green.yml up -d
# Run health checks on green
curl -f http://green.internal/health
# Switch traffic (update nginx upstream)
docker exec nginx nginx -s reload
# Remove blue after verification
docker compose -f docker-compose.blue.yml down
Config and Secret Management
| Platform | Config | Secrets |
|---|---|---|
| Compose | .env files, environment |
secrets: (file-based) |
| Swarm | docker config |
docker secret (encrypted Raft) |
| Kubernetes | ConfigMap |
Secret (base64, use sealed-secrets) |
Detection Patterns
# Find orchestration configurations
Glob: **/docker-stack*.yml
Glob: **/k8s/**/*.yaml
Glob: **/kubernetes/**/*.yaml
# Check for scaling readiness
Grep: "replicas|maxReplicas|scale" --glob "**/*.yml" --glob "**/*.yaml"
Grep: "session.save_handler.*redis" --glob "**/php*.ini"
Grep: "healthcheck|livenessProbe|readinessProbe" --glob "**/*.yml" --glob "**/*.yaml"当前收录版本
0.0.1
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供 Docker Swarm 和 Kubernetes 的完整编排模式
- 涵盖 PHP 应用负载均衡和自动扩缩容实践
- 包含零停机部署和蓝绿部署等生产级方案
亮点
- 触发词精准覆盖 Swarm、Kubernetes、PHP 负载均衡等核心场景
- 边界清晰,无歧义或重叠风险
待提升项
-
缺少 When to Use 章节 原报告严重程度:轻微
文档未明确说明适用场景和使用时机
改进建议:建议添加 When to Use 章节,说明何时使用此知识库
-
部分代码块无语言标识 原报告严重程度:轻微
架构图等纯文本 diagram 未标注语言类型
改进建议:为所有代码块添加合适的语言标识(如 plaintext)
亮点
- 章节划分清晰,涵盖编排、扩缩容、负载均衡等完整流程
- 提供端到端示例,包含 Stack 部署、K8s Manifest、Nginx 配置
亮点
- 工具来源明确,参数配置合理
- 覆盖健康检查、回滚、优雅关闭等关键异常处理
- 提供蓝绿部署等生产级变更流程
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
文档引用的域名或地址
这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。
- green.internal
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。