# initコマンド

## `init`コマンド

**説明**: ワンタイムアクセストークンを初期化します。

**パラメータ**

実行するサブコマンド

形式: **`ksm init <サブコマンド>`**

**サブコマンド**

<table data-header-hidden><thead><tr><th width="282.56638246041416">サブコマンド</th><th>説明</th></tr></thead><tbody><tr><td>サブコマンド</td><td>説明</td></tr><tr><td><code>default</code></td><td>引き換えられたトークンをbase64でエンコードされたJSONとして返します</td></tr><tr><td><code>k8s</code></td><td>引き換えられたトークンをKubernetesシークレットスクリプトとして返します</td></tr></tbody></table>

### **default**

ワンタイムアクセストークンを初期化し、Github ActionsやTerraformなどの外部統合で使用する設定プロファイルを作成します。設定の出力は、base64でエンコードされたJSON (デフォルト) またはk8s形式で生成できます。他のKSM開発者用SDKやアプリケーションは、この形式の設定を理解できます。

`ksm init default <トークン>`

オプションパラメータ

* `--plain` 設定をbase64でエンコードしません。プレーンなJSONを返します。
* `-h`, `--hostname` ホスト名を変更します。
* `--skip-ssl-verify` リモートSSL証明書を検証しません。

```
$ ksm init default XX:XXXX

ewogICAgImNsaWVudElkIjogInd ...U1R4eUQrU3ZNbkhrMTVLUHRGS2MrZlZJOGtlOUtL==
```

### k8s

ワンタイムアクセストークンを初期化して、Kubernetesシークレットスクリプトに設定します。

`ksm init k8s <トークン>`

オプションパラメータ

* `--name, -n` Kubernetesシークレットの名前。デフォルトは**ksm-config**です。
* `--namespace`, `--ns` Kubernetes名前空間の名前。デフォルトは**default**です。
* `--apply` 自動的にkubectlを使用してシークレットを適用します。シークレットのスクリプトは表示されません。
* `--immutable, -i` シークレットを改ざんできないようにします。Kubernetes 1.21以降が必要となります。
* `-h`, `--hostname` ホスト名を変更します。
* `--skip-ssl-verify` リモートSSL証明書を検証しません。

```
$ ksm init k8s XX:XXXX

apiVersion: v1
data:
  config: ewogICAgImNsaWVudElkIjogIml ... dWJsaWNLZXlJZCI6ICIxMCIKfQ==
kind: Secret
metadata:
  name: ksm-config
  namespace: default
type: Opaque
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.keeper.io/keeperpam/jp/secrets-manager/secrets-manager-command-line-interface/init-command.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
