Kubernetes : मेट्रिक्स सर्वर तैनात करें2023/09/04 |
Kubernetes क्लस्टर में CPU और मेमोरी संसाधनों की निगरानी के लिए मेट्रिक्स सर्वर तैनात करें।
यह उदाहरण निम्न प्रकार से पर्यावरण पर आधारित है।
-----------+---------------------------+--------------------------+------------ | | | eth0|10.0.0.25 eth0|10.0.0.71 eth0|10.0.0.72 +----------+-----------+ +-----------+-----------+ +-----------+-----------+ | [ ctrl.srv.world ] | | [snode01.srv.world] | | [snode02.srv.world] | | Control Plane | | Worker Node | | Worker Node | +----------------------+ +-----------------------+ +-----------------------+ |
[1] | Control Plane नोड पर मेट्रिक्स सर्वर तैनात करें। |
root@ctrl:~# git clone https://github.com/kubernetes-sigs/metrics-server
root@ctrl:~#
vi ./metrics-server/manifests/base/deployment.yaml ..... ..... containers: - name: metrics-server image: gcr.io/k8s-staging-metrics-server/metrics-server:master imagePullPolicy: IfNotPresent # पंक्ति 23: जोड़ें command: - /metrics-server - --kubelet-insecure-tls - --kubelet-preferred-address-types=InternalIP args: - --cert-dir=/tmp - --secure-port=10250 - --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname - --kubelet-use-node-status-port - --metric-resolution=15s ..... .....root@ctrl:~# kubectl apply -k ./metrics-server/manifests/base/ serviceaccount/metrics-server created clusterrole.rbac.authorization.k8s.io/system:aggregated-metrics-reader created clusterrole.rbac.authorization.k8s.io/system:metrics-server created rolebinding.rbac.authorization.k8s.io/metrics-server-auth-reader created clusterrolebinding.rbac.authorization.k8s.io/metrics-server:system:auth-delegator created clusterrolebinding.rbac.authorization.k8s.io/system:metrics-server created service/metrics-server created deployment.apps/metrics-server created apiservice.apiregistration.k8s.io/v1beta1.metrics.k8s.io createdroot@ctrl:~# kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
calico-kube-controllers-59697b644f-fgfqp 1/1 Running 1 (6m30s ago) 23h
calico-node-8hjm5 1/1 Running 1 (6m15s ago) 23h
calico-node-ck5zq 1/1 Running 1 (6m11s ago) 23h
calico-node-z8vgs 1/1 Running 1 (6m30s ago) 23h
coredns-565d847f94-v8v2x 1/1 Running 1 (6m30s ago) 24h
coredns-565d847f94-zh4rd 1/1 Running 1 (6m30s ago) 24h
etcd-ctrl.srv.world 1/1 Running 1 (6m30s ago) 24h
kube-apiserver-ctrl.srv.world 1/1 Running 1 (6m30s ago) 24h
kube-controller-manager-ctrl.srv.world 1/1 Running 1 (6m30s ago) 24h
kube-proxy-9hmsh 1/1 Running 1 (6m15s ago) 23h
kube-proxy-lnvhj 1/1 Running 1 (6m30s ago) 24h
kube-proxy-zftff 1/1 Running 1 (6m11s ago) 23h
kube-scheduler-ctrl.srv.world 1/1 Running 1 (6m30s ago) 24h
metrics-server-6776c5c959-5plm8 1/1 Running 0 88s
# [metrics-server] पॉड तैनात किया गया है
|
[2] | CPU और मेमोरी संसाधनों को प्रदर्शित करने के लिए, निम्नानुसार चलाएँ। |
root@ctrl:~# kubectl top node NAME CPU(cores) CPU% MEMORY(bytes) MEMORY% ctrl.srv.world 206m 2% 995Mi 6% snode01.srv.world 68m 0% 450Mi 2% snode02.srv.world 234m 2% 464Mi 2%root@ctrl:~# kubectl top pod NAME CPU(cores) MEMORY(bytes) test-nginx-5d84c8d9d4-78287 0m 6Mi test-nginx-5d84c8d9d4-cdsrt 0m 6Mi test-nginx-5d84c8d9d4-npnd5 0m 6Mi |
Sponsored Link |