WPF新手村教程(七)—— 终章(MVVM架构初见杀)
前言在使用 kubectl get $KIND -o yaml 查看 k8s 资源时输出结果中包含大量由集群自动生成的元数据如 managedFields、resourceVersion、uid 等。这些信息在实际复用 yaml 清单时需要手动清理增加了额外的工作量。使用 kubectl-neat 插件可以自动移除这些由集群生成的冗余字段仅保留有意义的内容使 yaml 更加简洁方便复用。安装插件方式安装kubectl krew install neat## 作为 kubectl 插件安装,使用方式为:kubectl neat二进制方式安装## 版本选择:## https://github.com/itaysk/kubectl-neat/releases## 当前环境为 ubuntu 2404 LTSwget https://github.com/itaysk/kubectl-neat/releases/download/v2.0.4/kubectl-neat_linux_amd64.tar.gztar xf kubectl-neat_linux_amd64.tar.gzmv ./kubectl-neat /usr/local/bin/## 创建别名(这里看个人习惯)vim /root/.bashrcalias kneatkubectl-neat使用本次使用二进制方式部署实际上参数是相同的没区别rootnetwork-demo:~# kubectl-neat helpUsage:kubectl-neat [flags]kubectl-neat [command]## 示例是通过 kubectl plugin 方式安装,使用二进制安装改成 kubectl-neat 就好Examples:kubectl get pod mypod -o yaml | kubectl neatkubectl get pod mypod -oyaml | kubectl neat -o jsonkubectl neat -f - ./my-pod.jsonkubectl neat -f ./my-pod.jsonkubectl neat -f ./my-pod.json --output yamlAvailable Commands:## 自动补全命令用的completion Generate the autocompletion script for the specified shellgethelp Help about any commandversion Print kubectl-neat versionFlags:-f, --file string file path to neat, or - to read from stdin (default -)-h, --help help for kubectl-neat-o, --output string output format: yaml or json (default yaml)命令补全简单来说就是按两下 tab 后自动补充没拼完的参数?? 注其实没啥用...他只能补全命令本身的参数并不能补全 k8s 相关信息rootnetwork-demo:~# kubectl-neat completion --helpGenerate the autocompletion script for kubectl-neat for the specified shell.See each sub-commands help for details on how to use the generated script.Usage:kubectl-neat completion [command]Available Commands:bash Generate the autocompletion script for bashfish Generate the autocompletion script for fishpowershell Generate the autocompletion script for powershellzsh Generate the autocompletion script for zshFlags:-h, --help help for completionGlobal Flags:-o, --output string output format: yaml or json (default yaml)## 当前环境使用 bashrootnetwork-demo:~# hostnamectlStatic hostname: network-demoIcon name: computer-vmChassis: vmVirtualization: kvmOperating System: Ubuntu 24.04.3 LTSKernel: Linux 6.8.0-88-genericArchitecture: x86-64## 添加命令补全echo source (kneat completion bash) ~/.bashrc source ~/.bashrc## 查看效果## 上面说没啥用的地方就在这...实际上能用的参数只有 get(kubectl-neat 自己的参数)## 当你补全 get 后就会发现他无法识别 k8s 资源rootnetwork-demo:~# kubectl-neatcompletion (Generate the autocompletion script for the specified shell) help (Help about any command)get version (Print kubectl-neat version)使用方式## 这里我直接将 kubectl get -o yaml 与 kubectl-neat get -o yaml 输出对比kubectl-neat get -- pods -n deepflow deepflow-server-fc484c85-p67gl -o yaml deepflow-kneat.yamlkubectl get pods -n deepflow deepflow-server-fc484c85-p67gl -o yaml deepflow-kubectl.yaml## 通过 icdiff 输出两个文件的对比结果,这里为了方便大家看,只把删除的内容放上来了rootnetwork-demo:~# icdiff deepflow-kubectl.yaml deepflow-kneat.yamlcreationTimestamp: 2026-01-23T02:24:57ZgenerateName: deepflow-server-fc484c85-generation: 1ownerReferences:- apiVersion: apps/v1blockOwnerDeletion: truecontroller: truekind: ReplicaSetname: deepflow-server-fc484c85uid: 528ab77f-67ba-4099-8771-bfe06ca9ce2fresourceVersion: 4864722uid: 0d5ff97b-9c48-4abf-be8b-d2b76f7a14d2nodeAffinity: {}apiVersion: v1apiVersion: v1apiVersion: v1apiVersion: v1apiVersion: v1scheme: HTTPsuccessThreshold: 1timeoutSeconds: 1protocol: TCPprotocol: TCPprotocol: TCPprotocol: TCPscheme: HTTPperiodSeconds: 10successThreshold: 1timeoutSeconds: 1resources: {}securityContext: {}terminationMessagePath: /dev/termination-logterminationMessagePolicy: FilednsConfig: {}dnsPolicy: ClusterFirstenableServiceLinks: truenodeName: network-demorestartPolicy: AlwaysschedulerName: default-schedulersecurityContext: {}serviceAccount: deepflow-serverterminationGracePeriodSeconds: 30defaultMode: 420defaultMode: 420apiVersion: v1status:## 下面是所有 status 内容...涡甘母轿
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2479393.html
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!