解决etcd服务--listen-metrics-urls=http://127.0.0.1:2381

 1、查看etcd的2381端口

[root@master-node manifests]# netstat -anp|grep 2381
tcp        0      0 127.0.0.1:2381      0.0.0.0:*               LISTEN      21765/etcd 

2、获取etcd的pod

[root@master-node manifests]# kubectl get pod -A
NAMESPACE       NAME                                    READY   STATUS    RESTARTS   AGE
cattle-system   cattle-cluster-agent-7f9549666f-vmxg4   0/1     Error     316        28h
kube-system     coredns-6d56c8448f-q4z57                1/1     Running   19         2d4h
kube-system     coredns-6d56c8448f-zfkq6                1/1     Running   20         2d4h
kube-system     etcd-master-node                        1/1     Running   0          13m
kube-system     kube-apiserver-master-node              1/1     Running   19         2d4h
kube-system     kube-controller-manager-master-node     1/1     Running   140        2d4h
kube-system     kube-flannel-ds-676v4                   1/1     Running   1          2d4h
kube-system     kube-flannel-ds-7jgt4                   0/1     Error     345        47h
kube-system     kube-proxy-bplzt                        1/1     Running   3          2d4h
kube-system     kube-proxy-dlg4d                        1/1     Running   1          47h
kube-system     kube-scheduler-master-node       

3、查看etcd的​​pod​​详细信息

[root@master-node manifests]# kubectl describe pod etcd-master-node -n kube-system
Name:                 etcd-master-node
Namespace:            kube-system
Priority:             2000001000
Priority Class Name:  system-node-critical
Node:                 master-node/192.168.0.122
Start Time:           Wed, 08 Nov 2023 12:21:48 +0800
Labels:               component=etcd
                      tier=control-plane
Annotations:          kubeadm.kubernetes.io/etcd.advertise-client-urls: https://192.168.0.122:2379
                      kubernetes.io/config.hash: 38ea1142faa6b3f8c460f84403b98231
                      kubernetes.io/config.mirror: 38ea1142faa6b3f8c460f84403b98231
                      kubernetes.io/config.seen: 2023-11-10T16:19:05.396386513+08:00
                      kubernetes.io/config.source: file
Status:               Running
IP:                   192.168.0.122
IPs:
  IP:           192.168.0.122
Controlled By:  Node/master-node
Containers:
  etcd:
    Container ID:  docker://4e1937cde08ee05e572d9e3b4e39e1fa44c5f9113dec93f21c4f616ae244dd60
    Image:         registry.aliyuncs.com/google_containers/etcd:3.4.13-0
    Image ID:      docker-pullable://registry.aliyuncs.com/google_containers/etcd@sha256:4ad90a11b55313b182afc186b9876c8e891531b8db4c9bf1541953021618d0e2
    Port:          <none>
    Host Port:     <none>
    Command:
      etcd
      --advertise-client-urls=https://192.168.0.122: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.0.122:2380
      --initial-cluster=master-node=https://192.168.0.122:2380
      --key-file=/etc/kubernetes/pki/etcd/server.key
      --listen-client-urls=https://127.0.0.1:2379,https://192.168.0.122:2379
      --listen-metrics-urls=http://127.0.0.1:2381
      --listen-peer-urls=https://192.168.0.122:2380
      --name=master-node
      --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
    State:          Running
      Started:      Fri, 10 Nov 2023 16:19:35 +0800
    Ready:          True
    Restart Count:  0
    Liveness:       http-get http://127.0.0.1:2381/health delay=10s timeout=15s period=10s #success=1 #failure=8
    Startup:        http-get http://127.0.0.1:2381/health delay=10s timeout=15s period=10s #success=1 #failure=24
    Environment:    <none>
    Mounts:
      /etc/kubernetes/pki/etcd from etcd-certs (rw)
      /var/lib/etcd from etcd-data (rw)
Conditions:
  Type              Status
  Initialized       True 
  Ready             True 
  ContainersReady   True 
  PodScheduled      True 
Volumes:
  etcd-certs:
    Type:          HostPath (bare host directory volume)
    Path:          /etc/kubernetes/pki/etcd
    HostPathType:  DirectoryOrCreate
  etcd-data:
    Type:          HostPath (bare host directory volume)
    Path:          /var/lib/etcd
    HostPathType:  DirectoryOrCreate
QoS Class:         BestEffort
Node-Selectors:    <none>
Tolerations:       :NoExecuteop=Exists
Events:
  Type    Reason   Age    From     Message
  ----    ------   ----   ----     -------
  Normal  Pulled   9m47s  kubelet  Container image "registry.aliyuncs.com/google_containers/etcd:3.4.13-0" already present on machine
  Normal  Created  9m47s  kubelet  Created container etcd
  Normal  Started  9m46s  kubelet  Started container etcd

 4、编辑etcd.yaml

vi /etc/kubernetes/manifests/etcd.yaml 

 5、验证

 

posted on 2023-11-10 16:38  uestc2007  阅读(398)  评论(0编辑  收藏  举报

导航