kube-lineage 是一个 kubectl 插件,用来展示 Kubernetes 集群资源的所有依赖资源或附属资源。
使用
$ kube-lineage pod coredns-5cc79d4bf5-xgvkc --dependencies
NAMESPACE NAME READY STATUS AGE
kube-system Pod/coredns-5cc79d4bf5-xgvkc 1/1 Running 30m
├── Node/k3d-server True KubeletReady 30m
├── PodSecurityPolicy/system-unrestricted-psp - 30m
kube-system ├── ConfigMap/coredns - 30m
kube-system ├── ReplicaSet/coredns-5cc79d4bf5 1/1 30m
kube-system │ └── Deployment/coredns 1/1 30m
kube-system ├── Secret/coredns-token-6vsx4 - 30m
kube-system │ └── ServiceAccount/coredns - 30m
│ ├── ClusterRoleBinding/system:basic-user - 30m
│ │ └── ClusterRole/system:basic-user - 30m
│ ├── ClusterRoleBinding/system:coredns - 30m
│ │ └── ClusterRole/system:coredns - 30m
│ ├── ClusterRoleBinding/system:discovery - 30m
│ │ └── ClusterRole/system:discovery - 30m
│ ├── ClusterRoleBinding/system:public-info-viewer - 30m
│ │ └── ClusterRole/system:public-info-viewer - 30m
kube-system │ └── RoleBinding/system-unrestricted-svc-acct-psp-rolebinding - 30m
│ └── ClusterRole/system-unrestricted-psp-role - 30m
│ └── PodSecurityPolicy/system-unrestricted-psp - 30m
kube-system └── ServiceAccount/coredns - 30m
安装
通过 krew 安装
$ kubectl krew install lineage
$ kubectl lineage --version
从源代码进行安装
$ git clone git@github.com:tohjustin/kube-lineage.git && cd kube-lineage
$ make install
$ kube-lineage --version