- kindでNodeを作成するときの設定を
nodes.kubeadmConfigPatches
でカスタマイズできるkubeadm
の設定をPatchを当てて変更する
ClusterConfiguration
のapiServer.extraArgs
にkube-apiserver
の追加の実行オプションを指定する- オプションの指定でkube-apiserverからホスト側のファイルを参照するには、Node・
kube-apiserver
コンテナの多段mountが必要になる点に注意
# --token-auth-fileオプションにホスト側の/tmp/config/tokensを指定する場合
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: cluster
nodes:
- role: control-plane
image: kindest/node:v1.23.0@sha256:49824ab1727c04e56a21a5d8372a402fcd32ea51ac96a2706a12af38934f81ac
kubeadmConfigPatches:
- |
kind: ClusterConfiguration
apiServer:
# 追加の実行オプション
extraArgs:
token-auth-file: /tmp/config/tokens
# コンテナ -> Nodeのmount
extraVolumes:
- name: config-token
hostPath: /tmp/config
mountPath: /tmp/config
readOnly: true
pathType: Directory
# Node -> ホストのmount
extraMounts:
- hostPath: /tmp/config
containerPath: /tmp/config
readOnly: true
- role: worker
image: kindest/node:v1.23.0@sha256:49824ab1727c04e56a21a5d8372a402fcd32ea51ac96a2706a12af38934f81ac
参考