2
2

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 5 years have passed since last update.

Raspberry PiのKubernetesにmetrics-serverを入れる

Last updated at Posted at 2019-09-22

この記事について

下記の記事に書いたkubernetesにmetrics serverを入れたというだけの記事。
https://qiita.com/yyojiro/items/0cd7ec7e2a39610be53f

構築手順

端的に書くと、git clone、編集、デプロイ、以上!
まずはgit cloneする。

root@k8s01:~# git clone https://github.com/kubernetes-incubator/metrics-server.git  

次に、deployに使うyamlファイルを編集する。

root@k8s01:~# vi metrics-server/deploy/1.8+/metrics-server-deployment.yaml     

変更点は下記の通り。
いろいろググった結果、commandでいろいろオプション指定するのが大事っぽい。

変更前
      containers:
      - name: metrics-server
        image: k8s.gcr.io/metrics-server-amd64:v0.3.4
        imagePullPolicy: Always

変更後
      containers:
      - name: metrics-server
        image: k8s.gcr.io/metrics-server-arm:v0.3.4
        imagePullPolicy: Always
        command:
        - /metrics-server
        - --metric-resolution=30s
        - --requestheader-allowed-names=aggregator
        - --kubelet-insecure-tls
        - --kubelet-preferred-address-types=InternalIP,InternalDNS,ExternalDNS,ExternalIP,Hostname

そしてデプロイ。

root@k8s01:~# kubectl apply -f metrics-server/deploy/1.8+/

確認

しばらくすると下記のようにメトリクスが取れるようになる(はず)。

root@k8s01:~# kubectl top node
NAME    CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%   
k8s01   504m         12%    603Mi           73%       
k8s02   266m         6%     342Mi           41%       
root@k8s01:~# 
root@k8s01:~# kubectl top pod --all-namespaces
NAMESPACE              NAME                                         CPU(cores)   MEMORY(bytes)   
kube-system            coredns-5644d7b6d9-4kl6n                     8m           6Mi             
kube-system            coredns-5644d7b6d9-665cp                     8m           13Mi            
kube-system            etcd-k8s01                                   53m          37Mi            
kube-system            kube-apiserver-k8s01                         118m         188Mi           
kube-system            kube-controller-manager-k8s01                30m          33Mi            
kube-system            kube-flannel-ds-arm-66xs4                    14m          8Mi             
kube-system            kube-flannel-ds-arm-mfjgp                    9m           11Mi            
kube-system            kube-proxy-55s9c                             3m           14Mi            
kube-system            kube-proxy-c9r6d                             2m           11Mi            
kube-system            kube-scheduler-k8s01                         6m           15Mi            
kube-system            metrics-server-585dd4dc5b-t67z9              5m           11Mi            
kubernetes-dashboard   dashboard-metrics-scraper-566cddb686-th5xc   2m           4Mi             
kubernetes-dashboard   kubernetes-dashboard-6ffd45c47d-fwnfv        5m           8Mi             
metallb-system         controller-6bcfdfd677-bqqwf                  1m           3Mi             
metallb-system         speaker-b2vwp                                3m           6Mi             
metallb-system         speaker-zrbzc                                3m           11Mi            
root@k8s01:~# 

最初うまく取れなかったが、よくわからんがOS再起動したらとれるようになった。
いろいろ謎がおおい。

2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?