LoginSignup
1
1

More than 5 years have passed since last update.

Tillerをマスタノードにスケジュールする他

Last updated at Posted at 2016-12-22

helmというKubernetes用のパッケージマネージャがあります。helmはhelmというクライアントと、tillerというKubernetesクラスタ側で稼働するサーバで構成されています。
この記事では、tillerをデフォルトとは異なる特別な設定でデプロイする方法を解説します。

変更点

  • rescheduler対応
  • マスタノードにスケジュールする
  • ローリングアップデート中もサービス停止しない

TL;DR;

以下をkubectl create -f ファイル名する

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    app: helm
    name: tiller
  name: tiller-deploy
  namespace: kube-system
  annotations:
    scheduler.alpha.kubernetes.io/critical-pod: ''
    scheduler.alpha.kubernetes.io/tolerations: '[{"key": "node.alpha.kubernetes.io/role", "value": "master", "effect": "NoSchedule" }, {"key":"CriticalAddonsOnly", "operator":"Exists"}]'
spec:
  replicas: 1
  strategy:
    rollingUpdate:
      maxSurge: 10%
      maxUnavailable: 0
  template:
    metadata:
      labels:
        app: helm
        name: tiller
    spec:
      containers:
      - image: gcr.io/kubernetes-helm/tiller:v2.1.2
        imagePullPolicy: IfNotPresent
        livenessProbe:
          httpGet:
            path: /liveness
            port: 44135
          initialDelaySeconds: 1
          timeoutSeconds: 1
        name: tiller
        ports:
        - containerPort: 44134
          name: tiller
        readinessProbe:
          httpGet:
            path: /readiness
            port: 44135
          initialDelaySeconds: 1
          timeoutSeconds: 1

基本的な流れ

helm init --dry-run --debug

を実行すると、tillerのDeploymentのためのmanifestが部分的に出力される。

metadata:
  creationTimestamp: null
  labels:
    app: helm
    name: tiller
  name: tiller-deploy
  namespace: kube-system
spec:
  replicas: 1
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: helm
        name: tiller
    spec:
      containers:
      - image: gcr.io/kubernetes-helm/tiller:v2.1.2
        imagePullPolicy: IfNotPresent
        livenessProbe:
          httpGet:
            path: /liveness
            port: 44135
          initialDelaySeconds: 1
          timeoutSeconds: 1
        name: tiller
        ports:
        - containerPort: 44134
          name: tiller
        readinessProbe:
          httpGet:
            path: /readiness
            port: 44135
          initialDelaySeconds: 1
          timeoutSeconds: 1
        resources: {}
      serviceAccountName: ""
      volumes: null
status: {}

これにapiVersionとtype等を追加して完全なmanifestにして、

apiVersion: extensions/v1beta1
kind: Deployment

kubectl create -f ファイル名を実行してDeploymentを作成する。

カスタマイズ内容

加えて、reschedulerで他のpodより優先的にスケジュールさせたい場合は、以下を追加するが、

metadata:
  annotations:
    scheduler.alpha.kubernetes.io/critical-pod: ''
    scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]'

今回はマスタノードにスケジュールするためのtolerationも必要なので、tolerationsは以下のようにする。

[{"key": "node.alpha.kubernetes.io/role", "value": "master", "effect": "NoSchedule" }, {"key":"CriticalAddonsOnly", "operator":"Exists"}]

ついでに、今後のtillerアップデート中に一時的にtillerがサービス停止してしまうことを防ぐためには、以下を追加。

spec:
  strategy:
    rollingUpdate:
      maxSurge: 10%
      maxUnavailable: 0
1
1
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
1
1