k8s-gitops
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseKubernetes GitOps
Kubernetes GitOps
GitOps workflows using Flux and ArgoCD with kubectl-mcp-server tools.
借助kubectl-mcp-server工具,使用Flux和ArgoCD实现GitOps工作流。
When to Apply
适用场景
Use this skill when:
- User mentions: "Flux", "ArgoCD", "GitOps", "sync", "reconcile"
- Operations: checking sync status, triggering reconciliation, drift detection
- Keywords: "out of sync", "deploy from git", "continuous delivery"
在以下场景中使用本技能:
- 用户提及:"Flux"、"ArgoCD"、"GitOps"、"sync(同步)"、"reconcile(调和)"
- 操作需求:查看同步状态、触发调和、漂移检测
- 关键词:"out of sync(不同步)"、"deploy from git(从Git部署)"、"continuous delivery(持续交付)"
Priority Rules
优先级规则
| Priority | Rule | Impact | Tools |
|---|---|---|---|
| 1 | Check source readiness before troubleshooting | CRITICAL | |
| 2 | Verify sync status before deployments | HIGH | |
| 3 | Reconcile after git changes | MEDIUM | |
| 4 | Suspend before manual changes | LOW | |
| 优先级 | 规则 | 影响级别 | 工具 |
|---|---|---|---|
| 1 | 排查问题前先检查源就绪状态 | 关键 | |
| 2 | 部署前验证同步状态 | 高 | |
| 3 | Git变更后执行调和 | 中 | |
| 4 | 手动变更前先暂停 | 低 | |
Quick Reference
快速参考
| Task | Tool | Example |
|---|---|---|
| List Flux kustomizations | | |
| Reconcile Flux | | |
| List ArgoCD apps | | |
| Sync ArgoCD | | |
| 任务 | 工具 | 示例 |
|---|---|---|
| 列出Flux的kustomizations | | |
| 执行Flux调和 | | |
| 列出ArgoCD应用 | | |
| 同步ArgoCD应用 | | |
Flux CD
Flux CD
Check Flux Status
检查Flux状态
python
flux_kustomizations_list_tool(namespace="flux-system")
flux_helmreleases_list_tool(namespace)
flux_sources_list_tool(namespace="flux-system")python
flux_kustomizations_list_tool(namespace="flux-system")
flux_helmreleases_list_tool(namespace)
flux_sources_list_tool(namespace="flux-system")Reconcile Resources
调和资源
python
flux_reconcile_tool(
kind="kustomization",
name="my-app",
namespace="flux-system"
)
flux_reconcile_tool(
kind="helmrelease",
name="my-chart",
namespace="default"
)python
flux_reconcile_tool(
kind="kustomization",
name="my-app",
namespace="flux-system"
)
flux_reconcile_tool(
kind="helmrelease",
name="my-chart",
namespace="default"
)Suspend/Resume
暂停/恢复
python
flux_suspend_tool(kind="kustomization", name="my-app", namespace="flux-system")
flux_resume_tool(kind="kustomization", name="my-app", namespace="flux-system")See FLUX.md for detailed Flux workflows.
python
flux_suspend_tool(kind="kustomization", name="my-app", namespace="flux-system")
flux_resume_tool(kind="kustomization", name="my-app", namespace="flux-system")查看FLUX.md获取Flux工作流的详细说明。
ArgoCD
ArgoCD
List Applications
列出应用
python
argocd_apps_list_tool(namespace="argocd")python
argocd_apps_list_tool(namespace="argocd")Get App Status
获取应用状态
python
argocd_app_get_tool(name="my-app", namespace="argocd")python
argocd_app_get_tool(name="my-app", namespace="argocd")Sync Application
同步应用
python
argocd_sync_tool(name="my-app", namespace="argocd")python
argocd_sync_tool(name="my-app", namespace="argocd")Refresh App
刷新应用
python
argocd_refresh_tool(name="my-app", namespace="argocd")See ARGOCD.md for detailed ArgoCD workflows.
python
argocd_refresh_tool(name="my-app", namespace="argocd")查看ARGOCD.md获取ArgoCD工作流的详细说明。
GitOps Troubleshooting
GitOps问题排查
Flux Not Syncing
Flux无法同步
| Symptom | Check | Resolution |
|---|---|---|
| Source not ready | | Check git credentials |
| Kustomization failed | | Check manifest errors |
| HelmRelease failed | | Check values, chart version |
| 症状 | 检查操作 | 解决方法 |
|---|---|---|
| 源未就绪 | | 检查Git凭证 |
| Kustomization执行失败 | | 检查清单文件错误 |
| HelmRelease执行失败 | | 检查配置值、Chart版本 |
ArgoCD Out of Sync
ArgoCD不同步
| Symptom | Check | Resolution |
|---|---|---|
| OutOfSync | | Manual sync or check auto-sync |
| Degraded | Check health status | Fix unhealthy resources |
| Unknown | Refresh app | |
| 症状 | 检查操作 | 解决方法 |
|---|---|---|
| 不同步(OutOfSync) | | 手动同步或检查自动同步配置 |
| 状态降级(Degraded) | 检查健康状态 | 修复不健康的资源 |
| 状态未知(Unknown) | 刷新应用 | |
Environment Promotion
环境升级
With Flux Kustomizations
使用Flux Kustomizations
python
flux_reconcile_tool(kind="kustomization", name="staging", namespace="flux-system")
flux_reconcile_tool(kind="kustomization", name="production", namespace="flux-system")python
flux_reconcile_tool(kind="kustomization", name="staging", namespace="flux-system")
flux_reconcile_tool(kind="kustomization", name="production", namespace="flux-system")With ArgoCD
使用ArgoCD
python
argocd_sync_tool(name="app-staging", namespace="argocd")
argocd_app_get_tool(name="app-staging", namespace="argocd")
argocd_sync_tool(name="app-production", namespace="argocd")python
argocd_sync_tool(name="app-staging", namespace="argocd")
argocd_app_get_tool(name="app-staging", namespace="argocd")
argocd_sync_tool(name="app-production", namespace="argocd")Multi-Cluster GitOps
多集群GitOps
Manage GitOps across clusters:
python
flux_kustomizations_list_tool(namespace="flux-system", context="cluster-1")
flux_kustomizations_list_tool(namespace="flux-system", context="cluster-2")
flux_reconcile_tool(
kind="kustomization",
name="apps",
namespace="flux-system",
context="production-cluster"
)跨集群管理GitOps:
python
flux_kustomizations_list_tool(namespace="flux-system", context="cluster-1")
flux_kustomizations_list_tool(namespace="flux-system", context="cluster-2")
flux_reconcile_tool(
kind="kustomization",
name="apps",
namespace="flux-system",
context="production-cluster"
)Drift Detection
漂移检测
Compare live state with desired:
python
argocd_app_get_tool(name="my-app", namespace="argocd")
flux_kustomizations_list_tool(namespace="flux-system")对比实际运行状态与期望状态:
python
argocd_app_get_tool(name="my-app", namespace="argocd")
flux_kustomizations_list_tool(namespace="flux-system")Prerequisites
前置条件
- Flux: Required for Flux tools
bash
flux install - ArgoCD: Required for ArgoCD tools
bash
kubectl create namespace argocd kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
- Flux:使用Flux工具前需安装
bash
flux install - ArgoCD:使用ArgoCD工具前需安装
bash
kubectl create namespace argocd kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
Related Skills
相关技能
- k8s-deploy - Standard deployments
- k8s-helm - Helm chart management
- k8s-deploy - 标准部署
- k8s-helm - Helm Chart管理