0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Ubuntu(20.04LTS) + Kubernetes(v1.21.3)にmetrics-serverをインストール

Posted at

#設定

基本はgithubのページの通りに設定していく。
一部追記が必要なため、yamlをダウンロードする。

$ wget https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
components.yaml
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    k8s-app: metrics-server
  name: metrics-server
  namespace: kube-system
spec:
  selector:
    matchLabels:
      k8s-app: metrics-server
  strategy:
    rollingUpdate:
      maxUnavailable: 0
  template:
    metadata:
      labels:
        k8s-app: metrics-server
    spec:
      containers:
      - args:
        - --cert-dir=/tmp
        - --secure-port=443
        - --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname
        - --kubelet-use-node-status-port
        - --metric-resolution=15s
        image: k8s.gcr.io/metrics-server/metrics-server:v0.5.0
        imagePullPolicy: IfNotPresent
+        command:
+        - /metrics-server
+        - --kubelet-insecure-tls
+        - --kubelet-preferred-address-types=InternalIP

#適用

$ kubectl apply -f components.yaml
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 created

#メトリクス収集確認

$ kubectl -n kube-system top pods
W0815 23:53:59.483427  528625 top_pod.go:140] Using json format to get metrics. Next release will switch to protocol-buffers, switch early by passing --use-protocol-buffers flag
NAME                                       CPU(cores)   MEMORY(bytes)
calico-kube-controllers-58497c65d5-gjbqc   4m           24Mi
calico-node-pkpbv                          65m          141Mi
coredns-558bd4d5db-8qbv7                   6m           16Mi
coredns-558bd4d5db-qfr55                   6m           15Mi
etcd-xxxxccc                               38m          46Mi
kube-apiserver-caltagx                     103m         479Mi
kube-controller-manager-caltagx            23m          63Mi
kube-proxy-d68mn                           1m           31Mi
kube-scheduler-caltagx                     5m           23Mi
metrics-server-6468fcbb58-kf7mc            5m           19Mi
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?