如何查看k8s存在etcd中的数据(转)
原文 https://yq.aliyun.com/articles/561888
一直有这个冲动,
想知道kubernetes往etcd里放了哪些数据,是如何组织的。
能看到,才有把握知道它的实现和细节。
找了很多文档,终于找到靠谱的。
===========================
https://www.jianshu.com/p/f9f83dd21770
===========================
操作etcd有命令行工具etcdctl,有两个api版本互不兼容的,系统默认的v2版本,kubernetes集群使用的是v3版本,v2版本下是看不到v3版本的数据的,我也是找了些资料才了解这个情况。
使用环境变量定义api版本
export ETCDCTL_API=3
etcd有目录结构类似linux文件系统,获取所有key看一看:
etcdctl get / --prefix --keys-only
一看就可以大概理解kubenetes的数据结构了,查询命名空间下所有部署的数据:etcdctl get /registry/deployments/default --prefix --keys-only
etcdctl del /registry/deployments/default/elevated-dragonfly-spinn-front50
删除deployments,pods这可以了,稍微减少一些资源,让kube-apiserver可以正常工作即可,其它资源还可以使用kubectl工具删除
删掉些资源后退出etcd把kube-apiserver的编排文件放回/etc/kubernetes/manifests目录,服务会再次启动,然后再清理重新部署。
=======================================
etcdctl get / --prefix
--keys-only
/registry/apiregistration.k8s.io/apiservices/v1.
/registry/apiregistration.k8s.io/apiservices/v1.apps
/registry/apiregistration.k8s.io/apiservices/v1.authentication.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1.authorization.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1.autoscaling
/registry/apiregistration.k8s.io/apiservices/v1.batch
/registry/apiregistration.k8s.io/apiservices/v1.networking.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1.rbac.authorization.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1.storage.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1beta1.admissionregistration.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1beta1.apiextensions.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1beta1.apps
/registry/apiregistration.k8s.io/apiservices/v1beta1.authentication.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1beta1.authorization.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1beta1.batch
/registry/apiregistration.k8s.io/apiservices/v1beta1.certificates.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1beta1.events.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1beta1.extensions
/registry/apiregistration.k8s.io/apiservices/v1beta1.policy
/registry/apiregistration.k8s.io/apiservices/v1beta1.rbac.authorization.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1beta1.storage.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1beta2.apps
/registry/apiregistration.k8s.io/apiservices/v2beta1.autoscaling
/registry/certificatesigningrequests/node-csr-NMpLG7rhBYiuAyRD739h79x2qhbhWn-UtLPFwJWJU1Y
/registry/certificatesigningrequests/node-csr-v96LRHUfeRD3iAZgHdUYxDaT1kkHvIilDnLZy2GPSew
/registry/clusterrolebindings/cluster-admin
/registry/clusterrolebindings/flannel
/registry/clusterrolebindings/heapster
/registry/clusterrolebindings/kubeadm:kubelet-bootstrap
/registry/clusterrolebindings/kubeadm:node-autoapprove-bootstrap
/registry/clusterrolebindings/kubeadm:node-autoapprove-certificate-rotation
/registry/clusterrolebindings/kubeadm:node-proxier
/registry/clusterrolebindings/kubernetes-dashboard
/registry/clusterrolebindings/system:aws-cloud-provider
/registry/clusterrolebindings/system:basic-user
/registry/clusterrolebindings/system:controller:attachdetach-controller
/registry/clusterrolebindings/system:controller:certificate-controller
/registry/clusterrolebindings/system:controller:clusterrole-aggregation-controller
/registry/clusterrolebindings/system:controller:cronjob-controller
/registry/clusterrolebindings/system:controller:daemon-set-controller
/registry/clusterrolebindings/system:controller:deployment-controller
/registry/clusterrolebindings/system:controller:disruption-controller
/registry/clusterrolebindings/system:controller:endpoint-controller
/registry/clusterrolebindings/system:controller:generic-garbage-collector
/registry/clusterrolebindings/system:controller:horizontal-pod-autoscaler
/registry/clusterrolebindings/system:controller:job-controller
/registry/clusterrolebindings/system:controller:namespace-controller
/registry/clusterrolebindings/system:controller:node-controller
/registry/clusterrolebindings/system:controller:persistent-volume-binder
/registry/clusterrolebindings/system:controller:pod-garbage-collector
/registry/clusterrolebindings/system:controller:replicaset-controller
/registry/clusterrolebindings/system:controller:replication-controller
/registry/clusterrolebindings/system:controller:resourcequota-controller
/registry/clusterrolebindings/system:controller:route-controller
/registry/clusterrolebindings/system:controller:service-account-controller
/registry/clusterrolebindings/system:controller:service-controller
/registry/clusterrolebindings/system:controller:statefulset-controller
/registry/clusterrolebindings/system:controller:ttl-controller
/registry/clusterrolebindings/system:coredns
/registry/clusterrolebindings/system:discovery
/registry/clusterrolebindings/system:kube-controller-manager
/registry/clusterrolebindings/system:kube-dns
/registry/clusterrolebindings/system:kube-scheduler
/registry/clusterrolebindings/system:node
/registry/clusterrolebindings/system:node-proxier
/registry/clusterroles/admin
/registry/clusterroles/cluster-admin
/registry/clusterroles/edit
/registry/clusterroles/flannel
/registry/clusterroles/system:aggregate-to-admin
/registry/clusterroles/system:aggregate-to-edit
/registry/clusterroles/system:aggregate-to-view
/registry/clusterroles/system:auth-delegator
/registry/clusterroles/system:aws-cloud-provider
/registry/clusterroles/system:basic-user
/registry/clusterroles/system:certificates.k8s.io:certificatesigningrequests:nodeclient
/registry/clusterroles/system:certificates.k8s.io:certificatesigningrequests:selfnodeclient
/registry/clusterroles/system:controller:attachdetach-controller
/registry/clusterroles/system:controller:certificate-controller
/registry/clusterroles/system:controller:clusterrole-aggregation-controller
/registry/clusterroles/system:controller:cronjob-controller
/registry/clusterroles/system:controller:daemon-set-controller
/registry/clusterroles/system:controller:deployment-controller
/registry/clusterroles/system:controller:disruption-controller
/registry/clusterroles/system:controller:endpoint-controller
/registry/clusterroles/system:controller:generic-garbage-collector
/registry/clusterroles/system:controller:horizontal-pod-autoscaler
/registry/clusterroles/system:controller:job-controller
/registry/clusterroles/system:controller:namespace-controller
/registry/clusterroles/system:controller:node-controller
/registry/clusterroles/system:controller:persistent-volume-binder
/registry/clusterroles/system:controller:pod-garbage-collector
/registry/clusterroles/system:controller:replicaset-controller
/registry/clusterroles/system:controller:replication-controller
/registry/clusterroles/system:controller:resourcequota-controller
/registry/clusterroles/system:controller:route-controller
/registry/clusterroles/system:controller:service-account-controller
/registry/clusterroles/system:controller:service-controller
/registry/clusterroles/system:controller:statefulset-controller
/registry/clusterroles/system:controller:ttl-controller
/registry/clusterroles/system:coredns
/registry/clusterroles/system:discovery
/registry/clusterroles/system:heapster
/registry/clusterroles/system:kube-aggregator
/registry/clusterroles/system:kube-controller-manager
/registry/clusterroles/system:kube-dns
/registry/clusterroles/system:kube-scheduler
/registry/clusterroles/system:node
/registry/clusterroles/system:node-bootstrapper
/registry/clusterroles/system:node-problem-detector
/registry/clusterroles/system:node-proxier
/registry/clusterroles/system:persistent-volume-provisioner
/registry/clusterroles/view
/registry/configmaps/kube-public/cluster-info
/registry/configmaps/kube-system/coredns
/registry/configmaps/kube-system/extension-apiserver-authentication
/registry/configmaps/kube-system/kube-flannel-cfg
/registry/configmaps/kube-system/kube-proxy
/registry/configmaps/kube-system/kubeadm-config
/registry/configmaps/kube-system/kubernetes-dashboard-settings
/registry/controllerrevisions/kube-system/kube-flannel-ds-dd8484577
/registry/controllerrevisions/kube-system/kube-proxy-95cfb667c
/registry/cronjobs/default/hello
/registry/daemonsets/kube-system/kube-flannel-ds
/registry/daemonsets/kube-system/kube-proxy
/registry/deployments/default/flower
/registry/deployments/default/pc-saveapi
/registry/deployments/default/pxxxm-django
/registry/deployments/default/pxxxm-redis
/registry/deployments/default/pxxxm-tengine-proxy
/registry/deployments/default/pxxxm-tengine-static
/registry/deployments/default/pxxxmlogapi-nj
/registry/deployments/kube-system/coredns
/registry/deployments/kube-system/heapster
/registry/deployments/kube-system/kubernetes-dashboard
/registry/deployments/kube-system/monitoring-grafana
/registry/deployments/kube-system/monitoring-influxdb
/registry/events/default/flower-554b58b968-n48sj.151de36ccc190d41
/registry/events/default/flower-554b58b968-n48sj.151de36e0d128ca9
/registry/events/default/hello.151e1bcd521ee391
/registry/jobs/default/hello-1521622920
/registry/jobs/default/hello-1521622980
/registry/jobs/default/hello-1521623040
/registry/minions/cnsz131381
/registry/minions/cnsz131382
/registry/minions/cnsz131383
/registry/namespaces/default
/registry/namespaces/kube-public
/registry/namespaces/kube-system
/registry/pods/default/flower-554b58b968-n48sj
/registry/pods/default/hello-1521622920-5z4bl
/registry/pods/default/hello-1521622980-4qcrd
/registry/pods/default/hello-1521623040-szf4f
/registry/pods/default/pc-saveapi-58cf87b4f5-5x2d8
/registry/pods/default/pxxxm-django-8466f46d84-4mjtf
/registry/pods/default/pxxxm-django-8466f46d84-pnqzp
/registry/pods/default/pxxxm-django-8466f46d84-x5d8z
/registry/pods/default/pxxxm-redis-767c5d5966-l88qj
/registry/pods/default/pxxxm-tengine-proxy-75d874d898-8275h
/registry/pods/default/pxxxm-tengine-static-7d7bb5d5b6-7568z
/registry/pods/default/pxxxmlogapi-nj-687cc89b96-ps4np
/registry/pods/kube-system/coredns-65dcdb4cf-hgmdv
/registry/pods/kube-system/etcd-cnsz131383
/registry/pods/kube-system/heapster-5996df699d-d8798
/registry/pods/kube-system/kube-apiserver-cnsz131383
/registry/pods/kube-system/kube-controller-manager-cnsz131383
/registry/pods/kube-system/kube-flannel-ds-gr8jp
/registry/pods/kube-system/kube-flannel-ds-p4tpq
/registry/pods/kube-system/kube-flannel-ds-z7s96
/registry/pods/kube-system/kube-proxy-cgjhk
/registry/pods/kube-system/kube-proxy-f7snz
/registry/pods/kube-system/kube-proxy-l98gl
/registry/pods/kube-system/kube-scheduler-cnsz131383
/registry/pods/kube-system/kubernetes-dashboard-5bd6f767c7-vr6sg
/registry/pods/kube-system/monitoring-grafana-6bf544559d-cd6d4
/registry/pods/kube-system/monitoring-influxdb-865d95895b-n9sls
/registry/ranges/serviceips
/registry/ranges/servicenodeports
/registry/replicasets/default/flower-554b58b968
/registry/replicasets/default/pc-saveapi-58cf87b4f5
/registry/replicasets/default/pxxxm-django-8466f46d84
/registry/replicasets/default/pxxxm-redis-767c5d5966
/registry/replicasets/default/pxxxm-tengine-proxy-75d874d898
/registry/replicasets/default/pxxxm-tengine-static-7d7bb5d5b6
/registry/replicasets/default/pxxxmlogapi-nj-687cc89b96
/registry/replicasets/kube-system/coredns-65dcdb4cf
/registry/replicasets/kube-system/heapster-5996df699d
/registry/replicasets/kube-system/kubernetes-dashboard-5bd6f767c7
/registry/replicasets/kube-system/monitoring-grafana-6bf544559d
/registry/replicasets/kube-system/monitoring-influxdb-865d95895b
/registry/rolebindings/kube-public/kubeadm:bootstrap-signer-clusterinfo
/registry/rolebindings/kube-public/system:controller:bootstrap-signer
/registry/rolebindings/kube-system/kubernetes-dashboard-minimal
/registry/rolebindings/kube-system/system::leader-locking-kube-controller-manager
/registry/rolebindings/kube-system/system::leader-locking-kube-scheduler
/registry/rolebindings/kube-system/system:controller:bootstrap-signer
/registry/rolebindings/kube-system/system:controller:cloud-provider
/registry/rolebindings/kube-system/system:controller:token-cleaner
/registry/roles/kube-public/kubeadm:bootstrap-signer-clusterinfo
/registry/roles/kube-public/system:controller:bootstrap-signer
/registry/roles/kube-system/extension-apiserver-authentication-reader
/registry/roles/kube-system/kubernetes-dashboard-minimal
/registry/roles/kube-system/system::leader-locking-kube-controller-manager
/registry/roles/kube-system/system::leader-locking-kube-scheduler
/registry/roles/kube-system/system:controller:bootstrap-signer
/registry/roles/kube-system/system:controller:cloud-provider
/registry/roles/kube-system/system:controller:token-cleaner
/registry/secrets/default/default-token-hfj82
/registry/secrets/kube-public/default-token-wpbfs
/registry/secrets/kube-system/attachdetach-controller-token-7jsks
/registry/secrets/kube-system/bootstrap-signer-token-xs87g
/registry/secrets/kube-system/certificate-controller-token-x4swr
/registry/secrets/kube-system/clusterrole-aggregation-controller-token-z7w85
/registry/secrets/kube-system/coredns-token-tbbbw
/registry/secrets/kube-system/cronjob-controller-token-p44bn
/registry/secrets/kube-system/daemon-set-controller-token-4klc2
/registry/secrets/kube-system/default-token-g9lcp
/registry/secrets/kube-system/deployment-controller-token-gfcdt
/registry/secrets/kube-system/disruption-controller-token-vs4dz
/registry/secrets/kube-system/endpoint-controller-token-92kn2
/registry/secrets/kube-system/flannel-token-wvgjq
/registry/secrets/kube-system/generic-garbage-collector-token-pcpnq
/registry/secrets/kube-system/heapster-token-6szhz
/registry/secrets/kube-system/horizontal-pod-autoscaler-token-xqcl5
/registry/secrets/kube-system/job-controller-token-422zr
/registry/secrets/kube-system/kube-proxy-token-k5rfq
/registry/secrets/kube-system/kubernetes-dashboard-certs
/registry/secrets/kube-system/kubernetes-dashboard-key-holder
/registry/secrets/kube-system/kubernetes-dashboard-token-kpkw7
/registry/secrets/kube-system/namespace-controller-token-r57ss
/registry/secrets/kube-system/node-controller-token-5f7sm
/registry/secrets/kube-system/persistent-volume-binder-token-7rnt2
/registry/secrets/kube-system/pod-garbage-collector-token-2txwf
/registry/secrets/kube-system/replicaset-controller-token-zh9xq
/registry/secrets/kube-system/replication-controller-token-q69jz
/registry/secrets/kube-system/resourcequota-controller-token-92hn4
/registry/secrets/kube-system/service-account-controller-token-vvw5d
/registry/secrets/kube-system/service-controller-token-lslnf
/registry/secrets/kube-system/statefulset-controller-token-wdqjt
/registry/secrets/kube-system/token-cleaner-token-9zzpv
/registry/secrets/kube-system/ttl-controller-token-tc7pl
/registry/serviceaccounts/default/default
/registry/serviceaccounts/kube-public/default
/registry/serviceaccounts/kube-system/attachdetach-controller
/registry/serviceaccounts/kube-system/bootstrap-signer
/registry/serviceaccounts/kube-system/certificate-controller
/registry/serviceaccounts/kube-system/clusterrole-aggregation-controller
/registry/serviceaccounts/kube-system/coredns
/registry/serviceaccounts/kube-system/cronjob-controller
/registry/serviceaccounts/kube-system/daemon-set-controller
/registry/serviceaccounts/kube-system/default
/registry/serviceaccounts/kube-system/deployment-controller
/registry/serviceaccounts/kube-system/disruption-controller
/registry/serviceaccounts/kube-system/endpoint-controller
/registry/serviceaccounts/kube-system/flannel
/registry/serviceaccounts/kube-system/generic-garbage-collector
/registry/serviceaccounts/kube-system/heapster
/registry/serviceaccounts/kube-system/horizontal-pod-autoscaler
/registry/serviceaccounts/kube-system/job-controller
/registry/serviceaccounts/kube-system/kube-proxy
/registry/serviceaccounts/kube-system/kubernetes-dashboard
/registry/serviceaccounts/kube-system/namespace-controller
/registry/serviceaccounts/kube-system/node-controller
/registry/serviceaccounts/kube-system/persistent-volume-binder
/registry/serviceaccounts/kube-system/pod-garbage-collector
/registry/serviceaccounts/kube-system/replicaset-controller
/registry/serviceaccounts/kube-system/replication-controller
/registry/serviceaccounts/kube-system/resourcequota-controller
/registry/serviceaccounts/kube-system/service-account-controller
/registry/serviceaccounts/kube-system/service-controller
/registry/serviceaccounts/kube-system/statefulset-controller
/registry/serviceaccounts/kube-system/token-cleaner
/registry/serviceaccounts/kube-system/ttl-controller
/registry/services/endpoints/default/flower
/registry/services/endpoints/default/kubernetes
/registry/services/endpoints/default/pc-saveapi
/registry/services/endpoints/default/pxxxm-django
/registry/services/endpoints/default/pxxxm-redis
/registry/services/endpoints/default/pxxxm-tengine-proxy
/registry/services/endpoints/default/pxxxm-tengine-static
/registry/services/endpoints/default/pxxxmlogapi-nj
/registry/services/endpoints/kube-system/heapster
/registry/services/endpoints/kube-system/kube-controller-manager
/registry/services/endpoints/kube-system/kube-dns
/registry/services/endpoints/kube-system/kube-scheduler
/registry/services/endpoints/kube-system/kubernetes-dashboard
/registry/services/endpoints/kube-system/monitoring-grafana
/registry/services/endpoints/kube-system/monitoring-influxdb
/registry/services/specs/default/flower
/registry/services/specs/default/kubernetes
/registry/services/specs/default/pc-saveapi
/registry/services/specs/default/pxxxm-django
/registry/services/specs/default/pxxxm-redis
/registry/services/specs/default/pxxxm-tengine-proxy
/registry/services/specs/default/pxxxm-tengine-static
/registry/services/specs/default/pxxxmlogapi-nj
/registry/services/specs/kube-system/heapster
/registry/services/specs/kube-system/kube-dns
/registry/services/specs/kube-system/kubernetes-dashboard
/registry/services/specs/kube-system/monitoring-grafana
/registry/services/specs/kube-system/monitoring-influxdb
如何查看k8s存在etcd中的数据(转)的更多相关文章
- 辛星浅谈mysql中的数据碎片以及引擎为MyISAM下的操作
对于mysql中的数据碎片,事实上和我们删除数据是息息相关的,删除数据的时候必定会在数据文件里造成不连续的空白空间,对于少量的数据的删除,并不会产生多少的空白空间.假设在一段时间内的大量的删除操作,会 ...
- [转帖]etcd 在超大规模数据场景下的性能优化
etcd 在超大规模数据场景下的性能优化 阿里系统软件技术 2019-05-27 09:13:17 本文共5419个字,预计阅读需要14分钟. http://www.itpub.net/2019/ ...
- etcd 在超大规模数据场景下的性能优化
作者 | 阿里云智能事业部高级开发工程师 陈星宇(宇慕) 概述 etcd是一个开源的分布式的kv存储系统, 最近刚被cncf列为沙箱孵化项目.etcd的应用场景很广,很多地方都用到了它,例如kuber ...
- 查看k8s中etcd数据
#查看etcd pod kubectl get pod -n kube-system | grep etcd #进入etcd pod kubectl exec -it -n kube-system e ...
- k8s 集群中的etcd故障解决
一次在k8s集群中创建实例发现etcd集群状态出现连接失败状况,导致创建实例失败.于是排查了一下原因. 问题来源 下面是etcd集群健康状态: [root@docker01 ~]# cd /opt/k ...
- k8s集群中遇到etcd集群故障的排查思路
一次在k8s集群中创建实例发现etcd集群状态出现连接失败状况,导致创建实例失败.于是排查了一下原因. 问题来源 下面是etcd集群健康状态: 1 2 3 4 5 6 7 8 9 10 11 [roo ...
- 通过dbcc page来查看表中的数据
--1.先建表 CREATE TABLE test(idd INT NOT NULL,name VARCHAR(10) NULL) INSERT INTO TEST SELECT 1,'abcdefg ...
- 查看hive中某个表中的数据、表结构及所在路径
查看hive中action_data_myisam表中的数据.表结构及所在路径 1.客户端进入hive环境:hive 2.查看表数据,鉴于数据量大,这里只显示前五条:select * from act ...
- lucene: 索引建立完后无法查看索引文件中的数据
索引建立时 1.对原有索引文件进行建立,是可以访问索引文件中的数据的 2.建立新索引文件,必须等建立完毕后,才可以访问,新建立的文件如果没有建立完是不可以被访问的 如果想建 ...
随机推荐
- python的闭包与延时绑定问题
起源于一道面试题... def mul(): return [lambda x : i*x for i in range(4)] print([m(2) for m in mul()]) # outp ...
- 双列集合Map
1.双列集合Map,就是存储key-value的键值对. 2.hashMap中键必须唯一,值可以不唯一. 3.主要方法:put添加数据 getKey---通过key获取数据 keySet- ...
- Oracle单机Rman笔记[0]---环境准备
A. 安装操作系统rhel6.6,关闭防火墙,修改网卡配置IP(略)PS:1.默认分区选项(第二项,默认为LVM),然后进行调整2.安装类型选择“桌面”3.安装后 分配IP.调整防火墙.测试SSH B ...
- 【问题】用ant编译时,提示编码utf为不可映射字符
分析:eclipse默认的编码为gbk,而ant里的build.xml文件里定义的为utf-8格式.两者格式不统一. 建议:将工程的编码改成utf-8的格式,一般java工程也建议为utf-8格式.
- 一个简易的allocator
#include <vector> #include <iostream> #include <algorithm> using namespace::std; t ...
- slick插件一些配置
- Sql语句内功心法
CREATE SCHEMA <模式名> AUTHORIZATION <用户名> 定义模式实际上定义了一个命名空间,在这个空间可以进一步定义该模式包含的数据库对象,例如基本表,视 ...
- VideoPlayer播放
播放网络视频.本地视频:可以暂停.前后拖动.快进.快退.音量调节.下一个视频 环境:Unity5.6以上 Unity正式发布了5.6版本后,作为5.x版本的最后一版还是有不少给力的更新的.其中新加入了 ...
- 剖析 GSM 加密机制以及位置更新的过程
你有没有想过打开手机时会发生什么?它是如何以安全的方式与网络进行通信?几乎所有人都知道TCP / IP,并且可能许多人还是专家,但是谈到电信方面,很少有人知道它的内部原理. gsm中的消息结构是什么? ...
- cmake使用方法详解
cmake 简介 CMake是一个跨平台的安装(编译)工具,可以用简单的语句来描述所有平台的安装(编译过程).他能够输出各种各样的makefile或者project文件,能测试编译器所支持的C++特性 ...