Skip to content

Latest commit

 

History

History
47 lines (41 loc) · 3.13 KB

etcd-k8s.MD

File metadata and controls

47 lines (41 loc) · 3.13 KB
alias ks=kubectl -n kube-system
ks get po etcd-cadmin -oyaml
spec:
  containers:
    - command:
        - etcd
        - --advertise-client-urls=https://192.168.34.2:2379
        - --cert-file=/etc/kubernetes/pki/etcd/server.crt
        - --client-cert-auth=true
        - --data-dir=/var/lib/etcd
        - --initial-advertise-peer-urls=https://192.168.34.2:2380
        - --initial-cluster=cadmin=https://192.168.34.2:2380
        - --key-file=/etc/kubernetes/pki/etcd/server.key
        - --listen-client-urls=https://127.0.0.1:2379,https://192.168.34.2:2379
        - --listen-metrics-urls=http://127.0.0.1:2381
        - --listen-peer-urls=https://192.168.34.2:2380
        - --name=cadmin
        - --peer-cert-file=/etc/kubernetes/pki/etcd/peer.crt
        - --peer-client-cert-auth=true
        - --peer-key-file=/etc/kubernetes/pki/etcd/peer.key
        - --peer-trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt
        - --snapshot-count=10000
        - --trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt
ks exec -it etcd-cadmin sh
ETCDCTL_API=3
alias ectl='etcdctl --endpoints https://127.0.0.1:2379 \
--cacert /etc/kubernetes/pki/etcd/ca.crt \
--cert /etc/kubernetes/pki/etcd/server.crt \
--key /etc/kubernetes/pki/etcd/server.key'

ectl member list

ectl get --prefix --keys-only /

ectl get /registry/services/specs/kube-system/kube-dns -w=json
{"header":{"cluster_id":10396955284310292238,"member_id":2496364209257137704,"revision":596482,"raft_term":8},"kvs":[{"key":"L3JlZ2lzdHJ5L3NlcnZpY2VzL3NwZWNzL2t1YmUtc3lzdGVtL2t1YmUtZG5z","create_revision":251,"mod_revision":251,"version":1,"value":"azhzAAoNCgJ2MRIHU2VydmljZRLfCAqbBwoIa3ViZS1kbnMSABoLa3ViZS1zeXN0ZW0iACokZTc0MmExMWYtMzY4NC00ZThkLWJhOGEtZWZiY2E2YTM0YzMwMgA4AEIICL+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