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.

helm install metrics-serverの方法

Last updated at Posted at 2020-08-20

最近kubenetesの学習をしておりhelmを使ってmetrics-serverのインストールする方法を
メモがわりに投稿します。

準備

helm inspect values stable/metrics-server > /tmp/metrics-server.values

hostNetwork:をfaulseからtrue
args:[] -> args:
kubelet-insecure-tlsのコメントアウトを外す

[vagrant@localhost ~]$ cat /tmp/metrics-server.values
rbac:
  # Specifies whether RBAC resources should be created
  create: true
  pspEnabled: false

serviceAccount:
  # Specifies whether a ServiceAccount should be created
  create: true
  # The name of the ServiceAccount to use.
  # If not set and create is true, a name is generated using the fullname template
  name:

apiService:
  # Specifies if the v1beta1.metrics.k8s.io API service should be created.
  #
  # You typically want this enabled! If you disable API service creation you have to
  # manage it outside of this chart for e.g horizontal pod autoscaling to
  # work with this release.
  create: true

hostNetwork:
  # Specifies if metrics-server should be started in hostNetwork mode.
  #
  # You would require this enabled if you use alternate overlay networking for pods and
  # API server unable to communicate with metrics-server. As an example, this is required
  # if you use Weave network on EKS
  enabled: true <--------ここ

image:
  repository: k8s.gcr.io/metrics-server-amd64
  tag: v0.3.6
  pullPolicy: IfNotPresent

imagePullSecrets: []
# - registrySecretName

args: <--------ここ
# enable this if you have self-signed certificates, see: https://github.com/kubernetes-incubator/metrics-server
- --kubelet-insecure-tls <--------ここ

resources: {}

nodeSelector: {}

tolerations: []

affinity: {}

replicas: 1

extraContainers: []

podLabels: {}

podAnnotations: {}
#  The following annotations guarantee scheduling for critical add-on pods.
#    See more at: https://kubernetes.io/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/
#  scheduler.alpha.kubernetes.io/critical-pod: ''

## Set a pod priorityClassName
# priorityClassName: system-node-critical

extraVolumeMounts: []
#  - name: secrets
#    mountPath: /etc/kubernetes/secrets
#    readOnly: true

extraVolumes: []
#  - name: secrets
#    secret:
#      secretName: kube-apiserver

livenessProbe:
  httpGet:
    path: /healthz
    port: https
    scheme: HTTPS
  initialDelaySeconds: 20

readinessProbe:
  httpGet:
    path: /healthz
    port: https
    scheme: HTTPS
  initialDelaySeconds: 20

securityContext:
  allowPrivilegeEscalation: false
  capabilities:
    drop: ["all"]
  readOnlyRootFilesystem: true
  runAsGroup: 10001
  runAsNonRoot: true
  runAsUser: 10001

service:
  annotations: {}
  labels: {}
  #  Add these labels to have metrics-server show up in `kubectl cluster-info`
  #  kubernetes.io/cluster-service: "true"
  #  kubernetes.io/name: "Metrics-server"
  port: 443
  type: ClusterIP

podDisruptionBudget:
  # https://kubernetes.io/docs/tasks/run-application/configure-pdb/
  enabled: false
  minAvailable:
  maxUnavailable:

[vagrant@localhost ~]$ 

インストール

[vagrant@localhost ~]$ helm install metrics-server stable/metrics-server --namespace operations --values /tmp/metrics-server.values 
NAME: metrics-server
LAST DEPLOYED: Thu Aug 20 23:41:55 2020
NAMESPACE: operations
STATUS: deployed
REVISION: 1
NOTES:
The metric server has been deployed. 

In a few minutes you should be able to list metrics using the following
command:

  kubectl get --raw "/apis/metrics.k8s.io/v1beta1/nodes"
[vagrant@localhost ~]$ helm list --all-namespaces
NAME          	NAMESPACE 	REVISION	UPDATED                                	STATUS  	CHART                	APP VERSION
metrics-server	operations	1       	2020-08-20 23:41:55.721917644 +0000 UTC	deployed	metrics-server-2.11.1	0.3.6      
[vagrant@localhost ~]$ 

確認

[vagrant@localhost ~]$ kubectl -n operations get all
NAME                                 READY   STATUS    RESTARTS   AGE
pod/metrics-server-9959f4577-drlzt   1/1     Running   0          45s

NAME                     TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)   AGE
service/metrics-server   ClusterIP   10.109.221.14   <none>        443/TCP   46s

NAME                             READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/metrics-server   1/1     1            1           46s

NAME                                       DESIRED   CURRENT   READY   AGE
replicaset.apps/metrics-server-9959f4577   1         1         1       45s
[vagrant@localhost ~]$ kubectl -n operations logs pod/metrics-server-9959f4577-drlzt
I0820 23:41:57.455795       1 serving.go:312] Generated self-signed cert (/tmp/apiserver.crt, /tmp/apiserver.key)
I0820 23:41:58.222724       1 secure_serving.go:116] Serving securely on [::]:8443
[vagrant@localhost ~]$ 
[vagrant@localhost ~]$ 
[vagrant@localhost ~]$ kubectl top nodes
NAME                   CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%   
kmaster.example.com    223m         11%    1109Mi          63%       
kworker1.example.com   59m          5%     326Mi           36%       
kworker2.example.com   66m          6%     416Mi           46%       
[vagrant@localhost ~]$ 
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?