Shumoku Docs

ドキュメントを検索

Server · next

検索を読み込み中…

English

このドキュメントは開発中のServerを対象としています。

apps/server/docs/helm-chart.md

Kubernetes / Helm

Helm Chartを使ったShumoku Serverのデプロイ方法です。

Shumoku Server を Kubernetes にデプロイするための Helm chart です。

Prerequisites

  • Kubernetes 1.25+
  • Helm 3.x
  • コンテナイメージが利用可能であること(ビルド済み or レジストリにプッシュ済み)

Quick Start

# デフォルト設定でインストール
helm upgrade --install shumoku oci://ghcr.io/konoe-akitoshi/charts/shumoku

# namespace を作成してインストール
helm upgrade --install shumoku oci://ghcr.io/konoe-akitoshi/charts/shumoku --namespace shumoku --create-namespace

# values ファイルを指定してインストール
helm upgrade --install shumoku oci://ghcr.io/konoe-akitoshi/charts/shumoku -f my-values.yaml

本番環境へのデプロイでは、以下のようにChartのバージョンを固定することを推奨します。

helm upgrade --install shumoku oci://ghcr.io/konoe-akitoshi/charts/shumoku \
  --version 0.1.6-beta.4

Configuration

values.yaml で設定可能なパラメータ一覧です。

Image

ParameterDescriptionDefault
image.repositoryコンテナイメージのリポジトリghcr.io/konoe-akitoshi/shumoku
image.tagイメージタグ(未指定時は appVersion""
image.pullPolicyイメージの pull ポリシーIfNotPresent

Service / Ingress

ParameterDescriptionDefault
service.typeService の typeClusterIP
service.portService のポート番号8080
ingress.enabledIngress を有効にするかfalse
ingress.classNameIngressClass 名""
ingress.annotationsIngress の annotations{}
ingress.hostsホスト・パスの設定[{host: shumoku.local, paths: [{path: /, pathType: Prefix}]}]
ingress.tlsTLS 設定[]

Persistence

ParameterDescriptionDefault
persistence.enabledPVC を作成するかtrue
persistence.accessModeアクセスモードReadWriteOnce
persistence.sizeストレージサイズ1Gi
persistence.storageClassStorageClass 名""
persistence.existingClaim既存の PVC 名を指定""

Application Config

config に値を設定すると ConfigMap としてマウントされます。

config:
  server:
    port: 8080
    host: 0.0.0.0
    dataDir: /data
    pollInterval: 5000
    backgroundPollInterval: 60000
    concurrencyLimit: 3

トポロジーとデータソースはSQLiteを正本としてWeb UIまたはREST APIから管理します。 設定ファイルからYAMLトポロジーを読み込む旧経路はありません。

Security

ParameterDescriptionDefault
auth.existingSecret初回管理者パスワードを持つ既存Secret名(新規環境では必須)""
auth.passwordKeySecret内のパスワードkeyadmin-password
auth.secureCookies管理者Cookieへ常にSecureを付与false
auth.trustProxyproxyのクライアントIPヘッダーをログイン制限に利用false
podSecurityContext.runAsUserPod の実行ユーザー1000
podSecurityContext.runAsGroupPod の実行グループ1000
podSecurityContext.fsGroupファイルシステムのグループ1000
securityContext.readOnlyRootFilesystemルートFS を読み取り専用にするかtrue

Other

ParameterDescriptionDefault
replicaCountレプリカ数1
demoModeサンプルデータとmock metricsを投入false
resourcesCPU/メモリの requests/limits{}
env追加の環境変数[]
nodeSelectorNode selector{}
tolerationsTolerations[]
affinityAffinity ルール{}
serviceAccount.createServiceAccount を作成するかtrue

Examples

初回管理者Secret

新しい環境では、Chartをインストールする前に管理者パスワードをSecretとして作成します。 SecretはConfigMapやvaluesファイルへ平文で書かず、既存Secretの名前だけをChartへ渡します。

kubectl create namespace shumoku
kubectl -n shumoku create secret generic shumoku-admin \
  --from-literal=admin-password="$(openssl rand -base64 32)"

helm upgrade --install shumoku oci://ghcr.io/konoe-akitoshi/charts/shumoku \
  --namespace shumoku \
  --set auth.existingSecret=shumoku-admin

初回起動後、DBにはArgon2idハッシュだけが保存されます。Secretを変更してPodを再起動しても 既存の管理者パスワードは上書きされません。変更はWeb UIの管理者設定から行います。

demoMode: trueはサンプルデータ投入だけを行い、認証を無効化しません。公開デモを構築する 場合は、visitorごとの使い捨てreleaseと固有の管理者Secretを外部ランチャーから作成し、 通常のログインフローを利用してください。

Ingress を有効にして TLS 設定

ingress:
  enabled: true
  className: nginx
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt
  hosts:
    - host: shumoku.example.com
      paths:
        - path: /
          pathType: Prefix
  tls:
    - secretName: shumoku-tls
      hosts:
        - shumoku.example.com

リソース制限を設定

resources:
  requests:
    cpu: 100m
    memory: 128Mi
  limits:
    cpu: 500m
    memory: 512Mi

Verification

chart の動作確認には以下のコマンドが使えます。

# Chart の情報を確認
helm show chart oci://ghcr.io/konoe-akitoshi/charts/shumoku

# レンダリング結果のプレビュー(クラスタ不要)
helm template test oci://ghcr.io/konoe-akitoshi/charts/shumoku

# config や ingress 有効時のプレビュー
helm template test oci://ghcr.io/konoe-akitoshi/charts/shumoku \
  --version 0.1.6-beta.4 --values my-values.yaml

# dry-run でインストールをシミュレーション(クラスタ必要)
helm install shumoku oci://ghcr.io/konoe-akitoshi/charts/shumoku --dry-run

# インストール後の状態確認
helm status shumoku
kubectl get pods -l app.kubernetes.io/name=shumoku
kubectl logs -l app.kubernetes.io/name=shumoku

Uninstall

helm uninstall shumoku
# PVC は helm uninstall では削除されません。手動で削除してください:
# kubectl delete pvc shumoku