[{"data":1,"prerenderedAt":323},["ShallowReactive",2],{"article-115":3,"site-data":40,"article-show-hot-115":167,"article-show-new-115":257},{"article":4,"breadcrumb":18,"category":23,"next":32,"prev":35,"second_categorys":38,"seo":39},{"id":5,"category_id":6,"title":7,"keywords":8,"description":9,"image_url":10,"content":11,"content_md":12,"url":13,"hits":14,"is_recommend":15,"is_top":15,"create_time":16,"update_time":17},115,21,"Kubernetes 100个常用命令","100 个 Kubectl 命令","这篇文章是关于使用 Kubectl 进行 Kubernetes 诊断的指南。列出了 100 个 Kubectl 命令，这些命令对于诊断 Kubernetes 集群中的问题非常有用。这些问题包括但不限于：•&nbsp;集群信息•&nbsp;Pod 诊断•&nbsp;服务诊断•&nbsp;部署诊断•&nbsp;网络诊断•&nbsp;持久卷和持久卷声明诊断•&nbsp;资源使用情况•&nbsp;安全和授权•&nbsp;节点故障排除•&nbsp;其他诊断命令：文章还提到了许多其他命令，如资源扩展和自动扩","","\u003Cblockquote>\u003Cp>这篇文章是关于使用 Kubectl 进行 Kubernetes 诊断的指南。\u003C/p>\u003Cp>列出了 100 个 Kubectl 命令，这些命令对于诊断 Kubernetes 集群中的问题非常有用。这些问题包括但不限于：\u003C/p>\u003Cul class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>•&nbsp;集群信息\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>•&nbsp;Pod 诊断\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>•&nbsp;服务诊断\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>•&nbsp;部署诊断\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>•&nbsp;网络诊断\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>•&nbsp;持久卷和持久卷声明诊断\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>•&nbsp;资源使用情况\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>•&nbsp;安全和授权\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>•&nbsp;节点故障排除\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>•&nbsp;其他诊断命令：文章还提到了许多其他命令，如资源扩展和自动扩展、作业和定时作业诊断、Pod 亲和性和反亲和性规则、RBAC 和安全、服务账号诊断、节点排空和取消排空、资源清理等。\u003C/p>\u003C/li>\u003C/ul>\u003C/blockquote>\u003Cp>\u003Cstrong>集群信息：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 显示 Kubernetes 版本：\u003Ccode>kubectl version\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 显示集群信息：\u003Ccode>kubectl cluster-info\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>3. 列出集群中的所有节点：\u003Ccode>kubectl get nodes\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>4. 查看一个具体的节点详情：\u003Ccode>kubectl describe node &lt;node-name&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>5. 列出所有命名空间：\u003Ccode>kubectl get namespaces\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>6. 列出所有命名空间中的所有 pod：\u003Ccode>kubectl get pods --all-namespaces\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>Pod 诊断：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 列出特定命名空间中的 pod：\u003Ccode>kubectl get pods -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 查看一个 Pod 详情：\u003Ccode>kubectl describe pod &lt;pod-name&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>3. 查看 Pod 日志：\u003Ccode>kubectl logs &lt;pod-name&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>4. 尾部 Pod 日志：\u003Ccode>kubectl logs -f &lt;pod-name&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>5. 在 pod 中执行命令：\u003Ccode>kubectl exec -it &lt;pod-name&gt; -n &lt;namespace&gt; -- &lt;command&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>Pod 健康检查：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 检查 Pod 准备情况：\u003Ccode>kubectl get pods &lt;pod-name&gt; -n &lt;namespace&gt; -o jsonpath='{.status.conditions[?(@.type==\"Ready\")].status}'\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 检查 Pod 事件：\u003Ccode>kubectl get events -n &lt;namespace&gt; --field-selector involvedObject.name=&lt;pod-name&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>Service诊断：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 列出命名空间中的所有服务：\u003Ccode>kubectl get svc -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 查看一个服务详情：\u003Ccode>kubectl describe svc &lt;service-name&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>Deployment诊断：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 列出命名空间中的所有Deployment：\u003Ccode>kubectl get deployments -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 查看一个Deployment详情：\u003Ccode>kubectl describe deployment &lt;deployment-name&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>3. 查看滚动发布状态：\u003Ccode>kubectl rollout status deployment/&lt;deployment-name&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>4. 查看滚动发布历史记录：\u003Ccode>kubectl rollout history deployment/&lt;deployment-name&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>StatefulSet诊断：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 列出命名空间中的所有 StatefulSet：\u003Ccode>kubectl get statefulsets -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 查看一个 StatefulSet详情：\u003Ccode>kubectl describe statefulset &lt;statefulset-name&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>ConfigMap 和Secret诊断：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 列出命名空间中的 ConfigMap：\u003Ccode>kubectl get configmaps -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 查看一个ConfigMap详情：\u003Ccode>kubectl describe configmap &lt;configmap-name&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>3. 列出命名空间中的 Secret：\u003Ccode>kubectl get secrets -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>4. 查看一个Secret详情：\u003Ccode>kubectl describe secret &lt;secret-name&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>命名空间诊断：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 查看一个命名空间详情：\u003Ccode>kubectl describe namespace &lt;namespace-name&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>资源使用情况：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 检查 pod 的资源使用情况：\u003Ccode>kubectl top pod &lt;pod-name&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 检查节点资源使用情况：\u003Ccode>kubectl top nodes\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>网络诊断：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 显示命名空间中 Pod 的 IP 地址：\u003Ccode>kubectl get pods -n &lt;namespace&gt; -o custom-columns=POD:metadata.name,IP:status.podIP --no-headers\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 列出命名空间中的所有网络策略：\u003Ccode>kubectl get networkpolicies -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>3. 查看一个网络策略详情：\u003Ccode>kubectl describe networkpolicy &lt;network-policy-name&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>持久卷 (PV) 和持久卷声明 (PVC) 诊断：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 列出PV：\u003Ccode>kubectl get pv\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 查看一个PV详情：\u003Ccode>kubectl describe pv &lt;pv-name&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>3. 列出命名空间中的 PVC：\u003Ccode>kubectl get pvc -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>4. 查看PVC详情：\u003Ccode>kubectl describe pvc &lt;pvc-name&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>节点诊断：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 获取特定节点上运行的 Pod 列表：\u003Ccode>kubectl get pods --field-selector spec.nodeName=&lt;node-name&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>资源配额和限制：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 列出命名空间中的资源配额：\u003Ccode>kubectl get resourcequotas -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 查看一个资源配额详情：\u003Ccode>kubectl describe resourcequota &lt;resource-quota-name&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>自定义资源定义 (CRD) 诊断：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 列出命名空间中的自定义资源：\u003Ccode>kubectl get &lt;custom-resource-name&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 查看自定义资源详情：\u003Ccode>kubectl describe &lt;custom-resource-name&gt; &lt;custom-resource-instance-name&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>使用这些命令时，请记住将\u003Ccode>&lt;namespace&gt;\u003C/code>,&nbsp;\u003Ccode>&lt;pod-name&gt;\u003C/code>,&nbsp;\u003Ccode>&lt;service-name&gt;\u003C/code>,&nbsp;\u003Ccode>&lt;deployment-name&gt;\u003C/code>,&nbsp;\u003Ccode>&lt;statefulset-name&gt;\u003C/code>,&nbsp;\u003Ccode>&lt;configmap-name&gt;\u003C/code>,&nbsp;\u003Ccode>&lt;secret-name&gt;\u003C/code>,&nbsp;\u003Ccode>&lt;namespace-name&gt;\u003C/code>,&nbsp;\u003Ccode>&lt;pv-name&gt;\u003C/code>,&nbsp;\u003Ccode>&lt;pvc-name&gt;\u003C/code>,&nbsp;\u003Ccode>&lt;node-name&gt;\u003C/code>,&nbsp;\u003Ccode>&lt;network-policy-name&gt;\u003C/code>,&nbsp;\u003Ccode>&lt;resource-quota-name&gt;\u003C/code>,&nbsp;\u003Ccode>&lt;custom-resource-name&gt;\u003C/code>, 和替换为你的特定值。\u003C/p>\u003Cp>\u003Ccode>&lt;custom-resource-instance-name&gt;\u003C/code>这些命令应该可以帮助你诊断 Kubernetes 集群以及在其中运行的应用程序。\u003C/p>\u003Cp>\u003Cstrong>资源伸缩和自动伸缩\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. Deployment伸缩：\u003Ccode>kubectl scale deployment &lt;deployment-name&gt; --replicas=&lt;replica-count&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 设置Deployment的自动伸缩：\u003Ccode>kubectl autoscale deployment &lt;deployment-name&gt; --min=&lt;min-pods&gt; --max=&lt;max-pods&gt; --cpu-percent=&lt;cpu-percent&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>3. 检查水平伸缩器状态：\u003Ccode>kubectl get hpa -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>作业和 CronJob 诊断：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 列出命名空间中的所有作业：\u003Ccode>kubectl get jobs -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 查看一份工作详情：\u003Ccode>kubectl describe job &lt;job-name&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>3. 列出命名空间中的所有 cron 作业：\u003Ccode>kubectl get cronjobs -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>4. 查看一个 cron 作业详情：\u003Ccode>kubectl describe cronjob &lt;cronjob-name&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>容量诊断：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 列出按容量排序的持久卷 (PV)：\u003Ccode>kubectl get pv --sort-by=.spec.capacity.storage\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 查看PV回收策略：\u003Ccode>kubectl get pv &lt;pv-name&gt; -o=jsonpath='{.spec.persistentVolumeReclaimPolicy}'\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>3. 列出所有存储类别：\u003Ccode>kubectl get storageclasses\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>Ingress和服务网格诊断：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 列出命名空间中的所有Ingress：\u003Ccode>kubectl get ingress -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 查看一个Ingress详情：\u003Ccode>kubectl describe ingress &lt;ingress-name&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>3. 列出命名空间中的所有 VirtualServices (Istio)：\u003Ccode>kubectl get virtualservices -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>4. 查看一个 VirtualService (Istio)详情：\u003Ccode>kubectl describe virtualservice &lt;virtualservice-name&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>Pod 网络故障排除：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 运行网络诊断 Pod（例如 busybox）进行调试：\u003Ccode>kubectl run -it --rm --restart=Never --image=busybox net-debug-pod -- /bin/sh\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 测试从 Pod 到特定端点的连接：\u003Ccode>kubectl exec -it &lt;pod-name&gt; -n &lt;namespace&gt; -- curl &lt;endpoint-url&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>3. 跟踪从一个 Pod 到另一个 Pod 的网络路径：\u003Ccode>kubectl exec -it &lt;source-pod-name&gt; -n &lt;namespace&gt; -- traceroute &lt;destination-pod-ip&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>4. 检查 Pod 的 DNS 解析：\u003Ccode>kubectl exec -it &lt;pod-name&gt; -n &lt;namespace&gt; -- nslookup &lt;domain-name&gt;\u003C/code>\u003Cspan style=\"text-align: justify;\">\u003C/span>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>配置和资源验证：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 验证 Kubernetes YAML 文件而不应用它：\u003Ccode>kubectl apply --dry-run=client -f &lt;yaml-file&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 验证 pod 的安全上下文和功能：\u003Ccode>kubectl auth can-i list pods --as=system:serviceaccount:&lt;namespace&gt;:&lt;serviceaccount-name&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>RBAC 和安全性：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 列出命名空间中的角色和角色绑定：\u003Ccode>kubectl get roles,rolebindings -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 查看角色或角色绑定详情：\u003Ccode>kubectl describe role &lt;role-name&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>服务帐户诊断：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 列出命名空间中的服务帐户：\u003Ccode>kubectl get serviceaccounts -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 查看一个服务帐户详情：\u003Ccode>kubectl describe serviceaccount &lt;serviceaccount-name&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>清空节点和解除封锁：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 清空节点以进行维护：\u003Ccode>kubectl drain &lt;node-name&gt; --ignore-daemonsets\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 解除对节点的封锁：\u003Ccode>kubectl uncordon &lt;node-name&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>资源清理：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 强制删除 pod（不推荐）：\u003Ccode>kubectl delete pod &lt;pod-name&gt; -n &lt;namespace&gt; --grace-period=0 --force\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>Pod 亲和性和反亲和性：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 列出 pod 的 pod 亲和性规则：\u003Ccode>kubectl get pod &lt;pod-name&gt; -n &lt;namespace&gt; -o=jsonpath='{.spec.affinity}'\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 列出 pod 的 pod 反亲和性规则：\u003Ccode>kubectl get pod &lt;pod-name&gt; -n &lt;namespace&gt; -o=jsonpath='{.spec.affinity.podAntiAffinity}'\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>Pod 安全策略 (PSP)：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 列出所有 Pod 安全策略（如果启用）：\u003Ccode>kubectl get psp\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>事件：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 查看最近的集群事件：\u003Ccode>kubectl get events --sort-by=.metadata.creationTimestamp\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 按特定命名空间过滤事件：\u003Ccode>kubectl get events -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>节点故障排除：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 检查节点情况：\u003Ccode>kubectl describe node &lt;node-name&gt; | grep Conditions -A5\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 列出节点容量和可分配资源：\u003Ccode>kubectl describe node &lt;node-name&gt; | grep -E \"Capacity|Allocatable\"\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>临时容器（Kubernetes 1.18+）：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 运行临时调试容器：\u003Ccode>kubectl debug -it &lt;pod-name&gt; -n &lt;namespace&gt; --image=&lt;debug-image&gt; -- /bin/sh\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>资源指标（需要指标服务器）：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 获取 Pod 的 CPU 和内存使用情况：\u003Ccode>kubectl top pod -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>kuelet诊断：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 查看节点上的kubelet日志：\u003Ccode>kubectl logs -n kube-system kubelet-&lt;node-name&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>使用Telepresence 进行高级调试：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 使用 Telepresence 调试 pod：\u003Ccode>telepresence --namespace &lt;namespace&gt; --swap-deployment &lt;pod-name&gt;\u003C/code>\u003Cspan style=\"text-align: center;\">\u003C/span>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>Kubeconfig 和上下文：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 列出可用的上下文：\u003Ccode>kubectl config get-contexts\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 切换到不同的上下文：\u003Ccode>kubectl config use-context &lt;context-name&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>Pod 安全标准（PodSecurity 准入控制器）：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 列出 PodSecurityPolicy (PSP) 违规行为：\u003Ccode>kubectl get psp -A | grep -vE 'NAME|REVIEWED'\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>Pod 中断预算 (PDB) 诊断：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 列出命名空间中的所有 PDB：\u003Ccode>kubectl get pdb -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 查看一个PDB详情：\u003Ccode>kubectl describe pdb &lt;pdb-name&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>资源锁诊断（如果使用资源锁）：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 列出命名空间中的资源锁：\u003Ccode>kubectl get resourcelocks -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>服务端点和 DNS：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 列出服务的服务端点：\u003Ccode>kubectl get endpoints &lt;service-name&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 检查 Pod 中的 DNS 配置：\u003Ccode>kubectl exec -it &lt;pod-name&gt; -n &lt;namespace&gt; -- cat /etc/resolv.conf\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>自定义指标（Prometheus、Grafana）：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 查询Prometheus指标：用于\u003Ccode>kubectl port-forward\u003C/code>访问Prometheus和Grafana服务来查询自定义指标。\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>Pod 优先级和抢占：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 列出优先级：\u003Ccode>kubectl get priorityclasses\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>Pod 开销（Kubernetes 1.18+）：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 列出 pod 中的开销：\u003Ccode>kubectl get pod &lt;pod-name&gt; -n &lt;namespace&gt; -o=jsonpath='{.spec.overhead}'\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>存储卷快照诊断（如果使用存储卷快照）：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 列出存储卷快照：\u003Ccode>kubectl get volumesnapshot -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 查看存储卷快照详情：\u003Ccode>kubectl describe volumesnapshot &lt;snapshot-name&gt; -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>资源反序列化诊断：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 反序列化并打印 Kubernetes 资源：\u003Ccode>kubectl get &lt;resource-type&gt; &lt;resource-name&gt; -n &lt;namespace&gt; -o=json\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>节点污点：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 列出节点污点：\u003Ccode>kubectl describe node &lt;node-name&gt; | grep Taints\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>更改和验证 Webhook 配置：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 列出变异 webhook 配置：\u003Ccode>kubectl get mutatingwebhookconfigurations\u003C/code>\u003C/p>\u003C/li>\u003Cli style=\"text-align: left;\">\u003Cp>2. 列出验证 Webhook 配置：\u003Ccode>kubectl get validatingwebhookconfigurations\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>Pod 网络策略：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 列出命名空间中的 pod 网络策略：\u003Ccode>kubectl get networkpolicies -n &lt;namespace&gt;\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>节点条件（Kubernetes 1.17+）：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 自定义查询输出：\u003Ccode>kubectl get nodes -o custom-columns=NODE:.metadata.name,READY:.status.conditions[?(@.type==\"Ready\")].status -l 'node-role.kubernetes.io/worker='\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>审核日志：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 检索审核日志（如果启用）：检查 Kubernetes 审核日志配置以了解审核日志的位置。\u003C/p>\u003C/li>\u003C/ol>\u003Cp>\u003Cstrong>节点操作系统详细信息：\u003C/strong>\u003C/p>\u003Col class=\"list-paddingleft-1\">\u003Cli style=\"text-align: left;\">\u003Cp>1. 获取节点的操作系统信息：\u003Ccode>kubectl get node &lt;node-name&gt; -o jsonpath='{.status.nodeInfo.osImage}'\u003C/code>\u003C/p>\u003C/li>\u003C/ol>\u003Cp>这些命令应该涵盖 Kubernetes 中的各种诊断场景。确保将\u003Ccode>&lt;namespace&gt;\u003C/code>、\u003Ccode>&lt;pod-name&gt;\u003C/code>、\u003Ccode>&lt;deployment-name&gt;\u003C/code>等占位符替换为你的集群和用例的实际值。\u003C/p>\u003Cdiv>\u003Cbr>\u003C/div>","> 这篇文章是关于使用 Kubectl 进行 Kubernetes 诊断的指南。列出了 100 个 Kubectl 命令，这些命令对于诊断 Kubernetes 集群中的问题非常有用。这些问题包括但不限于：• 集群信息• Pod 诊断• 服务诊断• 部署诊断• 网络诊断• 持久卷和持久卷声明诊断• 资源使用情况• 安全和授权• 节点故障排除• 其他诊断命令：文章还提到了许多其他命令，如资源扩展和自动扩展、作业和定时作业诊断、Pod 亲和性和反亲和性规则、RBAC 和安全、服务账号诊断、节点排空和取消排空、资源清理等。\n\n**集群信息：**\n\n1. 1. 显示 Kubernetes 版本：kubectl version\n2. 2. 显示集群信息：kubectl cluster-info\n3. 3. 列出集群中的所有节点：kubectl get nodes\n4. 4. 查看一个具体的节点详情：kubectl describe node\n5. 5. 列出所有命名空间：kubectl get namespaces\n6. 6. 列出所有命名空间中的所有 pod：kubectl get pods --all-namespaces\n\n**Pod 诊断：**\n\n1. 1. 列出特定命名空间中的 pod：kubectl get pods -n\n2. 2. 查看一个 Pod 详情：kubectl describe pod  -n\n3. 3. 查看 Pod 日志：kubectl logs  -n\n4. 4. 尾部 Pod 日志：kubectl logs -f  -n\n5. 5. 在 pod 中执行命令：kubectl exec -it  -n  --\n\n**Pod 健康检查：**\n\n1. 1. 检查 Pod 准备情况：kubectl get pods  -n  -o jsonpath='{.status.conditions[?(@.type==\"Ready\")].status}'\n2. 2. 检查 Pod 事件：kubectl get events -n  --field-selector involvedObject.name=\n\n**Service诊断：**\n\n1. 1. 列出命名空间中的所有服务：kubectl get svc -n\n2. 2. 查看一个服务详情：kubectl describe svc  -n\n\n**Deployment诊断：**\n\n1. 1. 列出命名空间中的所有Deployment：kubectl get deployments -n\n2. 2. 查看一个Deployment详情：kubectl describe deployment  -n\n3. 3. 查看滚动发布状态：kubectl rollout status deployment/ -n\n4. 4. 查看滚动发布历史记录：kubectl rollout history deployment/ -n\n\n**StatefulSet诊断：**\n\n1. 1. 列出命名空间中的所有 StatefulSet：kubectl get statefulsets -n\n2. 2. 查看一个 StatefulSet详情：kubectl describe statefulset  -n\n\n**ConfigMap 和Secret诊断：**\n\n1. 1. 列出命名空间中的 ConfigMap：kubectl get configmaps -n\n2. 2. 查看一个ConfigMap详情：kubectl describe configmap  -n\n3. 3. 列出命名空间中的 Secret：kubectl get secrets -n\n4. 4. 查看一个Secret详情：kubectl describe secret  -n\n\n**命名空间诊断：**\n\n1. 1. 查看一个命名空间详情：kubectl describe namespace\n\n**资源使用情况：**\n\n1. 1. 检查 pod 的资源使用情况：kubectl top pod  -n\n2. 2. 检查节点资源使用情况：kubectl top nodes\n\n**网络诊断：**\n\n1. 1. 显示命名空间中 Pod 的 IP 地址：kubectl get pods -n  -o custom-columns=POD:metadata.name,IP:status.podIP --no-headers\n2. 2. 列出命名空间中的所有网络策略：kubectl get networkpolicies -n\n3. 3. 查看一个网络策略详情：kubectl describe networkpolicy  -n\n\n**持久卷 (PV) 和持久卷声明 (PVC) 诊断：**\n\n1. 1. 列出PV：kubectl get pv\n2. 2. 查看一个PV详情：kubectl describe pv\n3. 3. 列出命名空间中的 PVC：kubectl get pvc -n\n4. 4. 查看PVC详情：kubectl describe pvc  -n\n\n**节点诊断：**\n\n1. 1. 获取特定节点上运行的 Pod 列表：kubectl get pods --field-selector spec.nodeName= -n\n\n**资源配额和限制：**\n\n1. 1. 列出命名空间中的资源配额：kubectl get resourcequotas -n\n2. 2. 查看一个资源配额详情：kubectl describe resourcequota  -n\n\n**自定义资源定义 (CRD) 诊断：**\n\n1. 1. 列出命名空间中的自定义资源：kubectl get  -n\n2. 2. 查看自定义资源详情：kubectl describe   -n\n\n使用这些命令时，请记住将``, ``, ``, ``, ``, ``, ``, ``, ``, ``, ``, ``, ``, ``, 和替换为你的特定值。\n\n``这些命令应该可以帮助你诊断 Kubernetes 集群以及在其中运行的应用程序。\n\n**资源伸缩和自动伸缩**\n\n1. 1. Deployment伸缩：kubectl scale deployment  --replicas= -n\n2. 2. 设置Deployment的自动伸缩：kubectl autoscale deployment  --min= --max= --cpu-percent= -n\n3. 3. 检查水平伸缩器状态：kubectl get hpa -n\n\n**作业和 CronJob 诊断：**\n\n1. 1. 列出命名空间中的所有作业：kubectl get jobs -n\n2. 2. 查看一份工作详情：kubectl describe job  -n\n3. 3. 列出命名空间中的所有 cron 作业：kubectl get cronjobs -n\n4. 4. 查看一个 cron 作业详情：kubectl describe cronjob  -n\n\n**容量诊断：**\n\n1. 1. 列出按容量排序的持久卷 (PV)：kubectl get pv --sort-by=.spec.capacity.storage\n2. 2. 查看PV回收策略：kubectl get pv  -o=jsonpath='{.spec.persistentVolumeReclaimPolicy}'\n3. 3. 列出所有存储类别：kubectl get storageclasses\n\n**Ingress和服务网格诊断：**\n\n1. 1. 列出命名空间中的所有Ingress：kubectl get ingress -n\n2. 2. 查看一个Ingress详情：kubectl describe ingress  -n\n3. 3. 列出命名空间中的所有 VirtualServices (Istio)：kubectl get virtualservices -n\n4. 4. 查看一个 VirtualService (Istio)详情：kubectl describe virtualservice  -n\n\n**Pod 网络故障排除：**\n\n1. 1. 运行网络诊断 Pod（例如 busybox）进行调试：kubectl run -it --rm --restart=Never --image=busybox net-debug-pod -- /bin/sh\n2. 2. 测试从 Pod 到特定端点的连接：kubectl exec -it  -n  -- curl\n3. 3. 跟踪从一个 Pod 到另一个 Pod 的网络路径：kubectl exec -it  -n  -- traceroute\n4. 4. 检查 Pod 的 DNS 解析：kubectl exec -it  -n  -- nslookup\n\n**配置和资源验证：**\n\n1. 1. 验证 Kubernetes YAML 文件而不应用它：kubectl apply --dry-run=client -f\n2. 2. 验证 pod 的安全上下文和功能：kubectl auth can-i list pods --as=system:serviceaccount::\n\n**RBAC 和安全性：**\n\n1. 1. 列出命名空间中的角色和角色绑定：kubectl get roles,rolebindings -n\n2. 2. 查看角色或角色绑定详情：kubectl describe role  -n\n\n**服务帐户诊断：**\n\n1. 1. 列出命名空间中的服务帐户：kubectl get serviceaccounts -n\n2. 2. 查看一个服务帐户详情：kubectl describe serviceaccount  -n\n\n**清空节点和解除封锁：**\n\n1. 1. 清空节点以进行维护：kubectl drain  --ignore-daemonsets\n2. 2. 解除对节点的封锁：kubectl uncordon\n\n**资源清理：**\n\n1. 1. 强制删除 pod（不推荐）：kubectl delete pod  -n  --grace-period=0 --force\n\n**Pod 亲和性和反亲和性：**\n\n1. 1. 列出 pod 的 pod 亲和性规则：kubectl get pod  -n  -o=jsonpath='{.spec.affinity}'\n2. 2. 列出 pod 的 pod 反亲和性规则：kubectl get pod  -n  -o=jsonpath='{.spec.affinity.podAntiAffinity}'\n\n**Pod 安全策略 (PSP)：**\n\n1. 1. 列出所有 Pod 安全策略（如果启用）：kubectl get psp\n\n**事件：**\n\n1. 1. 查看最近的集群事件：kubectl get events --sort-by=.metadata.creationTimestamp\n2. 2. 按特定命名空间过滤事件：kubectl get events -n\n\n**节点故障排除：**\n\n1. 1. 检查节点情况：kubectl describe node  | grep Conditions -A5\n2. 2. 列出节点容量和可分配资源：kubectl describe node  | grep -E \"Capacity|Allocatable\"\n\n**临时容器（Kubernetes 1.18+）：**\n\n1. 1. 运行临时调试容器：kubectl debug -it  -n  --image= -- /bin/sh\n\n**资源指标（需要指标服务器）：**\n\n1. 1. 获取 Pod 的 CPU 和内存使用情况：kubectl top pod -n\n\n**kuelet诊断：**\n\n1. 1. 查看节点上的kubelet日志：kubectl logs -n kube-system kubelet-\n\n**使用Telepresence 进行高级调试：**\n\n1. 1. 使用 Telepresence 调试 pod：telepresence --namespace  --swap-deployment\n\n**Kubeconfig 和上下文：**\n\n1. 1. 列出可用的上下文：kubectl config get-contexts\n2. 2. 切换到不同的上下文：kubectl config use-context\n\n**Pod 安全标准（PodSecurity 准入控制器）：**\n\n1. 1. 列出 PodSecurityPolicy (PSP) 违规行为：kubectl get psp -A | grep -vE 'NAME|REVIEWED'\n\n**Pod 中断预算 (PDB) 诊断：**\n\n1. 1. 列出命名空间中的所有 PDB：kubectl get pdb -n\n2. 2. 查看一个PDB详情：kubectl describe pdb  -n\n\n**资源锁诊断（如果使用资源锁）：**\n\n1. 1. 列出命名空间中的资源锁：kubectl get resourcelocks -n\n\n**服务端点和 DNS：**\n\n1. 1. 列出服务的服务端点：kubectl get endpoints  -n\n2. 2. 检查 Pod 中的 DNS 配置：kubectl exec -it  -n  -- cat /etc/resolv.conf\n\n**自定义指标（Prometheus、Grafana）：**\n\n1. 1. 查询Prometheus指标：用于kubectl port-forward访问Prometheus和Grafana服务来查询自定义指标。\n\n**Pod 优先级和抢占：**\n\n1. 1. 列出优先级：kubectl get priorityclasses\n\n**Pod 开销（Kubernetes 1.18+）：**\n\n1. 1. 列出 pod 中的开销：kubectl get pod  -n  -o=jsonpath='{.spec.overhead}'\n\n**存储卷快照诊断（如果使用存储卷快照）：**\n\n1. 1. 列出存储卷快照：kubectl get volumesnapshot -n\n2. 2. 查看存储卷快照详情：kubectl describe volumesnapshot  -n\n\n**资源反序列化诊断：**\n\n1. 1. 反序列化并打印 Kubernetes 资源：kubectl get   -n  -o=json\n\n**节点污点：**\n\n1. 1. 列出节点污点：kubectl describe node  | grep Taints\n\n**更改和验证 Webhook 配置：**\n\n1. 1. 列出变异 webhook 配置：kubectl get mutatingwebhookconfigurations\n2. 2. 列出验证 Webhook 配置：kubectl get validatingwebhookconfigurations\n\n**Pod 网络策略：**\n\n1. 1. 列出命名空间中的 pod 网络策略：kubectl get networkpolicies -n\n\n**节点条件（Kubernetes 1.17+）：**\n\n1. 1. 自定义查询输出：kubectl get nodes -o custom-columns=NODE:.metadata.name,READY:.status.conditions[?(@.type==\"Ready\")].status -l 'node-role.kubernetes.io/worker='\n\n**审核日志：**\n\n1. 1. 检索审核日志（如果启用）：检查 Kubernetes 审核日志配置以了解审核日志的位置。\n\n**节点操作系统详细信息：**\n\n1. 1. 获取节点的操作系统信息：kubectl get node  -o jsonpath='{.status.nodeInfo.osImage}'\n\n这些命令应该涵盖 Kubernetes 中的各种诊断场景。确保将``、``、``等占位符替换为你的集群和用例的实际值。","/article/115",3642,0,"2023-11-02 14:09:30","2023-11-02 14:10:05",[19,22],{"id":6,"name":20,"url":21},"分享无价","/article/lists?category_id=21",{"id":5,"name":7,"url":13},{"create_time":10,"description":10,"id":6,"image_url":10,"index_template":24,"is_cover":25,"is_menu":25,"keywords":10,"list_template":26,"model_code":27,"model_id":28,"model_name":29,"name":20,"parent_id":15,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":31,"subtitle":10,"update_time":10,"url":21},"index",1,"list","article",2,"文章模型","show",5,{"title":33,"url":34},"运维部门年度2025工作总结与2026工作规划应该如何写？","/article/116",{"title":36,"url":37},"主流典型各类应用服务器硬件配置分析","/article/96",[],{"description":9,"keywords":8,"title":7},{"settings":41,"categorys":71,"tree":121,"models":142,"search_model_select":152,"nav_list":154},{"changefreq":42,"changyan_app_id":10,"changyan_app_key":10,"copy":43,"description":44,"editor":45,"file":10,"guest_feedback":46,"head_html":10,"icp":47,"index_banner":48,"index_banner_bg":49,"is_excel":50,"is_watermark":46,"keywords":51,"links":52,"logo":53,"lzcms_banner":10,"lzcms_banner_link":54,"member_register_enabled":50,"qq_app_id":10,"qq_app_key":10,"qr_code":10,"search_model":55,"site_closedreason":10,"site_idea":10,"site_idea1":56,"site_idea2":57,"site_idea3":58,"site_name":59,"site_statistice":10,"site_status":50,"site_url":54,"sitemap_model":55,"stationmaster_motto":60,"stationmaster_name":61,"stationmaster_occupation":62,"stationmaster_qq":63,"stationmaster_qqnet":64,"stationmaster_qqnet_code":65,"threshold":50,"title_add":66,"watermark":10,"watermark_alpha":67,"watermark_height":68,"watermark_locate":69,"watermark_width":70},"weekly","版权所有 © \u003Ca class=\"site_url\" href=\"https://zhl123.com\">2026 zhl123.com\u003C/a>","linux、Python、mysql、docker、k8s技术交流","layedit","0","粤ICP备15054664号-1","/uploads/images/20181109/7a86191de8b8bb60e9c6b54d8b27c5cc.jpg","#xe604","1","linux、Python、mysql、docker、k8s","{\"1\":{\"id\":\"1\",\"link_url\":\"https://linux.org\",\"logo\":\"\",\"name\":\"linux\",\"sort\":\"0\",\"status\":\"1\"}}","/uploads/images/20181109/e7305012448aed257176dd591846f50a.png","https://zhl123.com","2","学无止境\n学习，探索，研究，从不了解到了解，从无知到掌握，到灵活运用，在不断的学习中加深认识。由浅入深，由表及里。","业精于勤\n“业精于勤荒于嬉”，精深的业技靠的是勤学、刻苦努力，靠的是争分夺秒的勤学苦练才会有精深的技术。得在认真，失在随便。","工匠精神\n精益求精，注重细节，追求完美和极致，不惜花费时间精力，孜孜不倦，反复改进产品，把99%提高到99.99%。","linux","业精于勤、学无止境、工匠精神","廖地金","高级Linux运维工程师","1256636645","592958303","\u003Ca target=\"_blank\" href=\"//shang.qq.com/wpa/qunwpa?idkey=09be7d1a682073783fd636102e666393169b8a8aac8f3393da1de57bcaa821a0\">\u003Cimg border=\"0\" src=\"//pub.idqqimg.com/wpa/images/group.png\" alt=\"Linux技术\" title=\"Linux技术\">\u003C/a>"," | Python | mysql | docker | k8s 技术交流","100","300","9","500",{"0":72,"17":86,"18":88,"19":91,"20":95,"21":99,"22":100,"25":104,"26":107,"27":113,"29":118},{"children":73},{"0":74,"25":78,"26":83},[75,6,76,77],25,22,26,[79,80,81,82],17,18,19,20,[84,85],27,29,{"create_time":10,"description":10,"id":79,"image_url":10,"index_template":24,"is_cover":25,"is_menu":25,"keywords":10,"list_template":26,"model_code":27,"model_id":28,"model_name":29,"name":59,"parent_id":75,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":25,"subtitle":10,"update_time":10,"url":87},"/article/lists?category_id=17",{"create_time":10,"description":10,"id":80,"image_url":10,"index_template":24,"is_cover":25,"is_menu":25,"keywords":10,"list_template":26,"model_code":27,"model_id":28,"model_name":29,"name":89,"parent_id":75,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":28,"subtitle":10,"update_time":10,"url":90},"python","/article/lists?category_id=18",{"create_time":10,"description":10,"id":81,"image_url":10,"index_template":24,"is_cover":25,"is_menu":25,"keywords":10,"list_template":26,"model_code":27,"model_id":28,"model_name":29,"name":92,"parent_id":75,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":93,"subtitle":10,"update_time":10,"url":94},"容器技术",3,"/article/lists?category_id=19",{"create_time":10,"description":10,"id":82,"image_url":10,"index_template":24,"is_cover":25,"is_menu":25,"keywords":10,"list_template":26,"model_code":27,"model_id":28,"model_name":29,"name":96,"parent_id":75,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":97,"subtitle":10,"update_time":10,"url":98},"负载均衡",4,"/article/lists?category_id=20",{"create_time":10,"description":10,"id":6,"image_url":10,"index_template":24,"is_cover":25,"is_menu":25,"keywords":10,"list_template":26,"model_code":27,"model_id":28,"model_name":29,"name":20,"parent_id":15,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":31,"subtitle":10,"update_time":10,"url":21},{"create_time":10,"description":10,"id":76,"image_url":10,"index_template":24,"is_cover":25,"is_menu":25,"keywords":10,"list_template":26,"model_code":27,"model_id":28,"model_name":29,"name":101,"parent_id":15,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":102,"subtitle":10,"update_time":10,"url":103},"随笔",6,"/article/lists?category_id=22",{"create_time":10,"description":10,"id":75,"image_url":10,"index_template":24,"is_cover":25,"is_menu":25,"keywords":10,"list_template":26,"model_code":27,"model_id":28,"model_name":29,"name":105,"parent_id":15,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":15,"subtitle":10,"update_time":10,"url":106},"学无止境","/article/lists?category_id=25",{"create_time":10,"description":10,"id":77,"image_url":10,"index_template":24,"is_cover":25,"is_menu":25,"keywords":10,"list_template":26,"model_code":108,"model_id":93,"model_name":109,"name":110,"parent_id":15,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":111,"subtitle":10,"update_time":10,"url":112},"picture","图集模型","关于",8,"/picture/lists?category_id=26",{"create_time":10,"description":10,"id":84,"image_url":10,"index_template":24,"is_cover":25,"is_menu":15,"keywords":10,"list_template":26,"model_code":114,"model_id":25,"model_name":115,"name":116,"parent_id":77,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":82,"subtitle":10,"update_time":10,"url":117},"page","单页模型","关于博主","/page/27",{"create_time":10,"description":10,"id":85,"image_url":10,"index_template":24,"is_cover":15,"is_menu":15,"keywords":10,"list_template":26,"model_id":15,"name":119,"parent_id":77,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":82,"subtitle":10,"update_time":10,"url":120},"留言","/feedback",[122,132,134,136],{"children":123,"create_time":10,"description":10,"id":75,"image_url":10,"index_template":24,"is_cover":25,"is_menu":25,"keywords":10,"list_template":26,"model_code":27,"model_id":28,"model_name":29,"name":105,"parent_id":15,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":15,"subtitle":10,"update_time":10,"url":106},[124,126,128,130],{"children":125,"create_time":10,"description":10,"id":79,"image_url":10,"index_template":24,"is_cover":25,"is_menu":25,"keywords":10,"list_template":26,"model_code":27,"model_id":28,"model_name":29,"name":59,"parent_id":75,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":25,"subtitle":10,"update_time":10,"url":87},[],{"children":127,"create_time":10,"description":10,"id":80,"image_url":10,"index_template":24,"is_cover":25,"is_menu":25,"keywords":10,"list_template":26,"model_code":27,"model_id":28,"model_name":29,"name":89,"parent_id":75,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":28,"subtitle":10,"update_time":10,"url":90},[],{"children":129,"create_time":10,"description":10,"id":81,"image_url":10,"index_template":24,"is_cover":25,"is_menu":25,"keywords":10,"list_template":26,"model_code":27,"model_id":28,"model_name":29,"name":92,"parent_id":75,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":93,"subtitle":10,"update_time":10,"url":94},[],{"children":131,"create_time":10,"description":10,"id":82,"image_url":10,"index_template":24,"is_cover":25,"is_menu":25,"keywords":10,"list_template":26,"model_code":27,"model_id":28,"model_name":29,"name":96,"parent_id":75,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":97,"subtitle":10,"update_time":10,"url":98},[],{"children":133,"create_time":10,"description":10,"id":6,"image_url":10,"index_template":24,"is_cover":25,"is_menu":25,"keywords":10,"list_template":26,"model_code":27,"model_id":28,"model_name":29,"name":20,"parent_id":15,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":31,"subtitle":10,"update_time":10,"url":21},[],{"children":135,"create_time":10,"description":10,"id":76,"image_url":10,"index_template":24,"is_cover":25,"is_menu":25,"keywords":10,"list_template":26,"model_code":27,"model_id":28,"model_name":29,"name":101,"parent_id":15,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":102,"subtitle":10,"update_time":10,"url":103},[],{"children":137,"create_time":10,"description":10,"id":77,"image_url":10,"index_template":24,"is_cover":25,"is_menu":25,"keywords":10,"list_template":26,"model_code":108,"model_id":93,"model_name":109,"name":110,"parent_id":15,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":111,"subtitle":10,"update_time":10,"url":112},[138,140],{"children":139,"create_time":10,"description":10,"id":84,"image_url":10,"index_template":24,"is_cover":25,"is_menu":15,"keywords":10,"list_template":26,"model_code":114,"model_id":25,"model_name":115,"name":116,"parent_id":77,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":82,"subtitle":10,"update_time":10,"url":117},[],{"children":141,"create_time":10,"description":10,"id":85,"image_url":10,"index_template":24,"is_cover":15,"is_menu":15,"keywords":10,"list_template":26,"model_id":15,"name":119,"parent_id":77,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":82,"subtitle":10,"update_time":10,"url":120},[],{"1":143,"2":144,"3":145,"4":146,"5":149},{"id":25,"index_template":24,"list_template":26,"name":115,"show_template":30,"status":15,"tablename":114},{"id":28,"index_template":24,"list_template":26,"name":29,"show_template":30,"status":15,"tablename":27},{"id":93,"index_template":24,"list_template":26,"name":109,"show_template":30,"status":15,"tablename":108},{"id":97,"index_template":24,"list_template":26,"name":147,"show_template":30,"status":15,"tablename":148},"链接模型","link",{"id":31,"index_template":24,"list_template":26,"name":150,"show_template":30,"status":15,"tablename":151},"下载模型","download",[153],{"id":28,"name":29,"tablename":27},[155,161,163,165],{"children":156,"create_time":10,"description":10,"id":75,"image_url":10,"index_template":24,"is_cover":25,"is_menu":25,"keywords":10,"list_template":26,"model_code":27,"model_id":28,"model_name":29,"name":105,"parent_id":15,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":15,"subtitle":10,"update_time":10,"url":106},[157,158,159,160],{"create_time":10,"description":10,"id":79,"image_url":10,"index_template":24,"is_cover":25,"is_menu":25,"keywords":10,"list_template":26,"model_code":27,"model_id":28,"model_name":29,"name":59,"parent_id":75,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":25,"subtitle":10,"update_time":10,"url":87},{"create_time":10,"description":10,"id":80,"image_url":10,"index_template":24,"is_cover":25,"is_menu":25,"keywords":10,"list_template":26,"model_code":27,"model_id":28,"model_name":29,"name":89,"parent_id":75,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":28,"subtitle":10,"update_time":10,"url":90},{"create_time":10,"description":10,"id":81,"image_url":10,"index_template":24,"is_cover":25,"is_menu":25,"keywords":10,"list_template":26,"model_code":27,"model_id":28,"model_name":29,"name":92,"parent_id":75,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":93,"subtitle":10,"update_time":10,"url":94},{"create_time":10,"description":10,"id":82,"image_url":10,"index_template":24,"is_cover":25,"is_menu":25,"keywords":10,"list_template":26,"model_code":27,"model_id":28,"model_name":29,"name":96,"parent_id":75,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":97,"subtitle":10,"update_time":10,"url":98},{"children":162,"create_time":10,"description":10,"id":6,"image_url":10,"index_template":24,"is_cover":25,"is_menu":25,"keywords":10,"list_template":26,"model_code":27,"model_id":28,"model_name":29,"name":20,"parent_id":15,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":31,"subtitle":10,"update_time":10,"url":21},[],{"children":164,"create_time":10,"description":10,"id":76,"image_url":10,"index_template":24,"is_cover":25,"is_menu":25,"keywords":10,"list_template":26,"model_code":27,"model_id":28,"model_name":29,"name":101,"parent_id":15,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":102,"subtitle":10,"update_time":10,"url":103},[],{"children":166,"create_time":10,"description":10,"id":77,"image_url":10,"index_template":24,"is_cover":25,"is_menu":25,"keywords":10,"list_template":26,"model_code":108,"model_id":93,"model_name":109,"name":110,"parent_id":15,"seo_description":10,"seo_keywords":10,"seo_title":10,"show_template":30,"sort":111,"subtitle":10,"update_time":10,"url":112},[],[168,177,186,195,204,213,222,231,240,248],{"id":169,"category_id":79,"title":170,"keywords":171,"description":172,"image_url":10,"url":173,"hits":174,"is_recommend":15,"is_top":15,"create_time":175,"update_time":176},101,"开启 HTTPS 并获得 ssllabs 满分的过程","开启,获得,满分,过程","准备工作确保你要申请证书的域名都解析到了这台服务器上，且能直接通过域名访问。使用官网推荐的CertBot获取证书。在CertBot官网选择一下环境(比如我选Nginx on Ubuntu 17.04)就可以看到入门教程了。安装CertBot12345apt-get updateapt-get install software-properties-commonadd-apt-repository ppa:certbot/certbotapt-get updateapt-get","/article/101",18546,"2019-11-26 16:12:11","2019-11-26 16:23:16",{"id":178,"category_id":79,"title":179,"keywords":180,"description":181,"image_url":10,"url":182,"hits":183,"is_recommend":15,"is_top":15,"create_time":184,"update_time":185},113,"在CentOS 7中添加命令自动补全功能","命令自动补全,centos","在CentOS 7中，默认情况下并不会安装命令补全包，需要手动安装才能使用命令补全功能。以下是在CentOS 7中安装命令补全包的方法：1. bash-completion：这是一个针对Bash shell的命令补全软件包，可以提供对系统命令、用户自定义命令和文件路径的自动补全功能。可以通过以下命令安装：```sudo yum install bash-completion```安装完成后，需要在/etc/profile配置文件中添加以下内容：```if [ -f /etc/bash_compl","/article/113",14948,"2023-05-16 10:54:01","2023-05-16 10:57:28",{"id":187,"category_id":79,"title":188,"keywords":189,"description":190,"image_url":10,"url":191,"hits":192,"is_recommend":25,"is_top":15,"create_time":193,"update_time":194},94,"Centos7 安装 openvas ","openvas,开放式漏洞评估系统，installing openvas centos-7","一、描述OpenVAS，即开放式漏洞评估系统，是一个用于评估目标漏洞的杰出框架。功能十分强大，最重要的是，它是“开源”的——就是免费的意思啦～它与著名的Nessus“本是同根生”，在Nessus商业化之后仍然坚持开源，号称“当前最好用的开源漏洞扫描工具”。最新版的Kali Linux(kali 3.0)不再自带OpenVAS了，所以我们要自己部署OpenVAS漏洞检测系统。其核心部件是一个服务器，包括一套网络漏洞测试程序，可以检测远程系统和应用程序中的安全问题。但是它的最常用用途是检测目标网络或","/article/94",14690,"2019-01-14 17:43:42","2019-01-14 18:16:36",{"id":196,"category_id":79,"title":197,"keywords":198,"description":199,"image_url":10,"url":200,"hits":201,"is_recommend":15,"is_top":15,"create_time":202,"update_time":203},99,"Centos7 利用iptables防止nmap工具防端口扫描","iptables","一、Nmap介绍       Nmap（NetworkMapper）是一款开放源代码的网络探测和安全审核工具。它用于快速扫描一个网络和一台主机开放的端口，还能使用TCP/IP协议栈特征探测远程主机的操作系统类型。nmap支持很多扫描技术，例如：UDP、TCPconnect()、TCPSYN(半开扫描)、ftp代理(bounce攻击)、反向标志、ICMP、FIN、ACK扫描、圣诞树(XmasTree)、SYN扫描和null扫描。Nmap最初是用于Unix系统","/article/99",14415,"2019-07-09 21:27:00","2019-07-09 21:57:53",{"id":205,"category_id":81,"title":206,"keywords":207,"description":208,"image_url":10,"url":209,"hits":210,"is_recommend":15,"is_top":15,"create_time":211,"update_time":212},61,"Docker 推荐的启动方式","推荐,启动,方式","# cat DockerfileFROM openjdk:8-alpineWORKDIR /ADD ./target/*.jar app.jarEXPOSE 9999COPY docker-entrypoint.sh /RUN chmod +x /docker-entrypoint.shENTRYPOINT [“/docker-entrypoint.sh”]CMD [“java”,”-server”,”-Duser.timezone=GMT+08″,”-jar”,”/app.jar”]# cat","/article/61",14347,"2018-10-22 13:55:47","2018-10-22 13:56:10",{"id":214,"category_id":79,"title":215,"keywords":216,"description":217,"image_url":10,"url":218,"hits":219,"is_recommend":15,"is_top":15,"create_time":220,"update_time":221},107,"Acme.sh 给 SSL 证书自动续期失败的解决方法","HTTP/1.1 200 OK,Server: Bayou Tech Web Srv 1.0,Content-Encoding: none,Content-Length: 5,Content-Type","一、Acme.sh 自动续期失败的症状问题描述如下，续期的时候，提示如下错误：root@dc:~# \"/data/acme.sh\"/acme.sh --cron --home \"/data/acme.sh\" &gt; /dev/null[Sun Nov 10 23:52:17 CST 2020] Error, can not get domain token entry example.com[Sun Nov 10 23:52:17 CST 2020] Please check log file","/article/107",12618,"2021-09-03 10:44:18","2021-09-03 10:46:23",{"id":223,"category_id":79,"title":224,"keywords":225,"description":226,"image_url":10,"url":227,"hits":228,"is_recommend":25,"is_top":15,"create_time":229,"update_time":230},93,"ELK+Filebeat+Kafka+ZooKeeper 构建海量日志分析平台","Filebeat,Kafka","一、说明1.Filebeat是一个日志文件托运工具，在你的服务器上安装客户端后，filebeat会监控日志目录或者指定的日志文件，追踪读取这些文件（追踪文件的变化，不停的读）2.Kafka是一种高吞吐量的分布式发布订阅消息系统，它可以处理消费者规模的网站中的所有动作流数据3.Logstash是一根具备实时数据传输能力的管道，负责将数据信息从管道的输入端传输到管道的输出端；与此同时这根管道还可以让你根据自己的需求在中间加上滤网，Logstash提供里很多功能强大的滤网以满足你的各种应用场景4.El","/article/93",12190,"2018-12-24 16:40:08","2018-12-26 11:53:38",{"id":232,"category_id":81,"title":233,"keywords":234,"description":235,"image_url":10,"url":236,"hits":237,"is_recommend":25,"is_top":15,"create_time":238,"update_time":239},81,"kubernetes 1.12.1 高可用安装之部署Dashboard","安装Dashboard","创建Dashboard需要CoreDNS部署成功之后再安装Dashboard。[root@master01 ~]# wget https://zhl123.com/download/k8s/Dashboard.tgz[root@master01 ~]# tar xf Dashboard.tgz[root@master01 ~]# kubectl create -f Dashboard/[root@master01 Dashboard]# kubectl get svc -n kube-syste","/article/81",12037,"2018-10-26 09:54:41","2018-10-26 16:59:19",{"id":241,"category_id":79,"title":242,"keywords":10,"description":243,"image_url":10,"url":244,"hits":245,"is_recommend":15,"is_top":15,"create_time":246,"update_time":247},100,"用 Nginx 给 Cookie 增加 Secure 和 HttpOnly","在 nginx 的 location 中配置12# 只支持 proxy 模式下设置，SameSite 不需要可删除，如果想更安全可以把 SameSite 设置为 Strictproxy_cookie_path / \"/; httponly; secure; SameSite=Lax\";示例1234567891011121314151617181920212223242526server {    listen 443 ssl http2;    server_name www.zhl123.cn","/article/100",11848,"2019-11-26 16:10:57","2019-11-26 16:23:45",{"id":249,"category_id":79,"title":250,"keywords":251,"description":252,"image_url":10,"url":253,"hits":254,"is_recommend":15,"is_top":15,"create_time":255,"update_time":256},41,"Tomcat 安全配置与性能优化","tomcat，性能优化","1. JVM&nbsp;1.1. 使用 Server JRE 替代JDK。&nbsp;服务器上不要安装JDK，请使用 Server JRE. 服务器上根本不需要编译器，代码应该在Release服务器上完成编译打包工作。&nbsp;理由：一旦服务器被控制，可以防止在其服务器上编译其他恶意代码并植入到你的程序中。&nbsp;1.2. JAVA_OPTS&nbsp;export JAVA_OPTS=\"-server -Xms512m -Xmx4096m &nbsp;-XX:PermSize=64M -","/article/41",11623,"2016-09-01 17:06:36","2018-10-18 17:06:58",[258,266,274,282,290,298,306,314,321,322],{"id":259,"category_id":6,"title":260,"keywords":10,"description":261,"image_url":10,"url":262,"hits":263,"is_recommend":15,"is_top":15,"create_time":264,"update_time":265},123,"Agent Skill 精选集：最值得收藏的 Agent Skills Top 10","如果你正在用 Claude Code 或 Codex，一定对&nbsp;Agent Skills&nbsp;不陌生。通过安装&nbsp;Agent Skills，你可以让这些 AI 助手变得更强——不用每次都解释你的需求，它们直接就知道该怎么做。最近有人在 GitHub 上做了一个采样调查，统计了哪些 Skills 的质量最佳和最受欢迎。我整理了这份&nbsp;Top 10 榜单，加上使用场景和适合人群，帮你快速找到最有用的那几个。Top 10 最受欢迎的 Agent Skills1. Skil","/article/123",270,"2026-01-19 18:49:12","2026-01-19 18:52:01",{"id":267,"category_id":79,"title":268,"keywords":10,"description":269,"image_url":10,"url":270,"hits":271,"is_recommend":15,"is_top":15,"create_time":272,"update_time":273},122,"Nginx性能调优18条黄金法则：支撑10万并发的配置模板","一、概述1.1 背景介绍说实话，Nginx调优这事儿我踩过无数坑。记得2019年双11，我们电商平台流量暴涨，Nginx直接扛不住了，QPS从平时的2万飙升到8万，响应时间从50ms飙到了2秒，最后还是靠临时加机器扛过去的。那次事故之后，我花了大半年时间专门研究Nginx的性能极限，总结出了这20条黄金法则。Nginx作为目前最流行的Web服务器和反向代理，官方数据显示单机可以轻松处理10万+的并发连接。但实际生产环境中，很多同学拿到默认配置就直接上了，结果发现连1万并发都扛不住。问题不在Ngi","/article/122",337,"2026-01-12 11:11:50","2026-01-12 11:12:28",{"id":275,"category_id":81,"title":276,"keywords":10,"description":277,"image_url":10,"url":278,"hits":279,"is_recommend":15,"is_top":15,"create_time":280,"update_time":281},121,"Docker 镜像优化与安全扫描：将镜像体积压缩 70%","1. 适用场景 & 前置条件项目要求适用场景容器化应用镜像体积过大（> 500MB），构建时间长（> 10分钟），存在安全漏洞（CVE高危）OSRHEL/CentOS 7.9+ 或 Ubuntu 20.04+内核Linux Kernel 3.10+软件版本Docker 20.10+ 或 Podman 3.0+，Trivy 0.40+（安全扫描工具）资源规格2C4G（最小）/ 4C8G（推荐），磁盘 50GB+（存储镜像与缓存）网络可访问 Docker Hub/阿里云镜像仓库（","/article/121",309,"2026-01-06 11:54:35","2026-01-06 12:01:59",{"id":283,"category_id":79,"title":284,"keywords":10,"description":285,"image_url":10,"url":286,"hits":287,"is_recommend":15,"is_top":15,"create_time":288,"update_time":289},120,"用 Prometheus Recording Rules 把告警噪声砍掉 70%(二)","五、故障排查和监控5.1 故障排查◆ 5.1.1 日志查看# 查看 Prometheus 日志中的规则评估错误journalctl -u prometheus | grep -i&nbsp;\"rule\"&nbsp;|&nbsp;tail&nbsp;-50# 查看规则评估耗时curl -s http://localhost:9090/api/v1/rules | jq&nbsp;'.data.groups[].rules[] | select(.health != \"ok\")'# Kubernet","/article/120",282,"2026-01-06 11:53:50","2026-01-06 11:54:33",{"id":291,"category_id":79,"title":292,"keywords":10,"description":293,"image_url":10,"url":294,"hits":295,"is_recommend":15,"is_top":15,"create_time":296,"update_time":297},119,"用 Prometheus Recording Rules 把告警噪声砍掉 70%(一)","一、概述1.1 背景介绍在大规模微服务架构下，Prometheus 告警系统往往会陷入一个尴尬的境地：告警太多，运维团队开始选择性忽略；告警太少，真正的故障又可能漏掉。我在某电商平台负责监控体系建设时，团队每天要处理超过 2000 条告警，其中 70% 以上是重复的、关联的或者短暂抖动产生的噪声。Recording Rules 是 Prometheus 提供的预计算机制，可以将复杂的查询表达式预先计算并存储为新的时间序列。通过合理设计 Recording Rules，我们不仅能显著降低 Prom","/article/119",301,"2026-01-06 11:51:58","2026-01-06 11:53:45",{"id":299,"category_id":79,"title":300,"keywords":10,"description":301,"image_url":10,"url":302,"hits":303,"is_recommend":15,"is_top":15,"create_time":304,"update_time":305},118,"GitOps 落地实践：ArgoCD + Kustomize 实现声明式基础设施管理(二)","四、最佳实践和注意事项4.1 最佳实践4.1.1 性能优化优化点一：减少 Git 轮询频率# argocd-cm ConfigMapapiVersion:&nbsp;v1kind:&nbsp;ConfigMapmetadata:&nbsp;&nbsp;name:&nbsp;argocd-cm&nbsp;&nbsp;namespace:&nbsp;argocddata:&nbsp;&nbsp;timeout.reconciliation:&nbsp;300s&nbsp;&nbsp;# 默认 180","/article/118",305,"2026-01-06 11:49:00","2026-01-06 11:49:34",{"id":307,"category_id":79,"title":308,"keywords":10,"description":309,"image_url":10,"url":310,"hits":311,"is_recommend":15,"is_top":15,"create_time":312,"update_time":313},117,"GitOps 落地实践：ArgoCD + Kustomize 实现声明式基础设施管理(一)","一、概述1.1 背景介绍GitOps 作为云原生时代的运维范式，将 Git 作为基础设施和应用配置的单一事实来源，通过声明式配置和自动化同步机制，实现了配置管理的版本控制、审计追溯和快速回滚。ArgoCD 作为 CNCF 毕业项目，提供了完整的 GitOps 工作流，支持多集群管理、RBAC 权限控制、SSO 集成等企业级特性。结合 Kustomize 的配置管理能力，能够优雅地解决多环境配置差异、敏感信息管理、配置复用等问题。在传统的 CI/CD 流程中，往往由 CI 工具直接执行 kubec","/article/117",310,"2026-01-06 11:45:03","2026-01-06 11:48:56",{"id":315,"category_id":6,"title":33,"keywords":316,"description":317,"image_url":10,"url":34,"hits":318,"is_recommend":15,"is_top":15,"create_time":319,"update_time":320},116,"运维部门年度2025工作总结,2026工作规划","2025年，运维部在公司“数字化转型深化”战略引领下，以“稳定为基、效率为纲、安全为盾、创新为翼”为核心导向，全面支撑核心业务系统运行、推动技术架构迭代、强化团队能力建设。 全年实现核心业务系统可用性99.985%，较2024年提升0.02个百分点；故障平均恢复时间（MTTR）从42分钟压缩至29分钟，下降31%；云资源成本同比降低16.8%，自动化运维覆盖率从65%提升至83%，未发生重大生产安全事故，圆满完成年度目标。现将全年工作及2026年规划汇报如下：2025年核心工作成果（数",297,"2026-01-06 11:20:58","2026-01-06 11:44:04",{"id":5,"category_id":6,"title":7,"keywords":8,"description":9,"image_url":10,"url":13,"hits":14,"is_recommend":15,"is_top":15,"create_time":16,"update_time":17},{"id":178,"category_id":79,"title":179,"keywords":180,"description":181,"image_url":10,"url":182,"hits":183,"is_recommend":15,"is_top":15,"create_time":184,"update_time":185},1784716028276]