Skip to content

Commit ffb1fd8

Browse files
farr-slmnSuleyman FarrakhovLada LysenkoZhbertLada7878
authored
Documentation updates (#20)
* - swapped vault cli to stronghold * - replaced cli commands to `d8 stronghold` - fix secrets-store-integration ModuleConfig - added disable_local_ca_jwt field for remote kube auth * text revisions Signed-off-by: Lada Lysenko <lada.lysenko@flant.com> * Update docs/USAGE_RU.md Co-authored-by: Lada7878 <127337005+Lada7878@users.noreply.github.com> Signed-off-by: Konstantin Nezhbert <zhbert@yandex.ru> * Update docs/USAGE_RU.md Co-authored-by: Lada7878 <127337005+Lada7878@users.noreply.github.com> Signed-off-by: Konstantin Nezhbert <zhbert@yandex.ru> * Update docs/USAGE_RU.md Co-authored-by: Lada7878 <127337005+Lada7878@users.noreply.github.com> Signed-off-by: Konstantin Nezhbert <zhbert@yandex.ru> * Updates * Update docs/USAGE_RU.md Signed-off-by: Artem Kladov <6360800+z9r5@users.noreply.github.com> --------- Signed-off-by: Lada Lysenko <lada.lysenko@flant.com> Signed-off-by: Konstantin Nezhbert <zhbert@yandex.ru> Signed-off-by: Artem Kladov <6360800+z9r5@users.noreply.github.com> Co-authored-by: Suleyman Farrakhov <suleiman.farrakhov@flant.com> Co-authored-by: Lada Lysenko <lada.lysenko@flant.com> Co-authored-by: Konstantin Nezhbert <konstantin.nezhbert@flant.com> Co-authored-by: Lada7878 <127337005+Lada7878@users.noreply.github.com> Co-authored-by: Artem Kladov <6360800+z9r5@users.noreply.github.com>
1 parent 8c77f41 commit ffb1fd8

File tree

2 files changed

+84
-45
lines changed

2 files changed

+84
-45
lines changed

docs/USAGE.md

Lines changed: 48 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Usage of the secrets-store-integration Deckhouse module.
55

66
## Configuring the module to work with Deckhouse Stronghold
77

8-
[Enable](../../stronghold/stable/usage.html#how-to-enable-the-module) the Stronghold module beforehand to automatically configure the secrets-store-integration module to work with [Deckhouse Stronghold](../../stronghold/).
8+
[Enable](../../stronghold/stable/usage.html#how-to-enable-the-module) the Stronghold module beforehand to automatically configure the secrets-store-integration module to work with [Deckhouse Stronghold](../../stronghold/stable/).
99

1010
Next, apply the `ModuleConfig`:
1111

@@ -43,11 +43,12 @@ spec:
4343
authPath: "main-kube"
4444
caCert: |
4545
-----BEGIN CERTIFICATE-----
46-
MIIFoTCCA4mgAwIBAgIUX9kFz7OxlBlALMEj8WsegZloXTowDQYJKoZIhvcNAQEL
46+
kD8MMYv5NHHko/3jlBJCjVG6cI+5HaVekOqRN9l3D9ZXsdg2RdXLU8CecQAD7yYa
4747
................................................................
48-
WoR9b11eYfyrnKCYoSqBoi2dwkCkV1a0GN9vStwiBnKnAmV3B8B5yMnSjmp+42gt
49-
o2SYzqM=
48+
C2ZTJJonuI8dA4qUadvCXrsQqJEa2nw1rql4LfPP5ztJz1SwNCSYH7EmwqW+Q7WR
49+
bZ6GhOj=
5050
-----END CERTIFICATE-----
51+
connectionConfiguration: Manual
5152
```
5253

5354
**It is strongly recommended to set the `caCert` variable. Otherwise, the module will use system ca-certificates.**
@@ -66,7 +67,7 @@ export VAULT_ADDR=https://secretstoreexample.com
6667
{{< /alert >}}
6768

6869
> This guide will cover two ways to do this:
69-
> * using the console version of Stronghold ([Get stronghold cli](#get-stronghold-cli));
70+
> * using the console version of Stronghold ([Download the d8 multitool](#download--the-d8-multitool-for-stronghold-commands));
7071
> * using curl to make direct requests to the secrets store API.
7172

7273
Before proceeding with the secret injection instructions in the examples below, do the following:
@@ -83,7 +84,7 @@ Example commands to set up the environment:
8384
* Enable and create the Key-Value store:
8485

8586
```bash
86-
stronghold secrets enable -path=demo-kv -version=2 kv
87+
d8 stronghold secrets enable -path=demo-kv -version=2 kv
8788
```
8889
The same command as a curl HTTP request:
8990

@@ -98,7 +99,7 @@ Example commands to set up the environment:
9899
* Set the database username and password as the value of the secret:
99100

100101
```bash
101-
stronghold kv put demo-kv/myapp-secret DB_USER="username" DB_PASS="secret-password"
102+
d8 stronghold kv put demo-kv/myapp-secret DB_USER="username" DB_PASS="secret-password"
102103
```
103104
The curl equivalent of the above command:
104105

@@ -113,9 +114,9 @@ Example commands to set up the environment:
113114
* Double-check that the password has been saved successfully:
114115

115116
```bash
116-
stronghold kv get demo-kv/myapp-secret
117+
d8 stronghold kv get demo-kv/myapp-secret
117118
```
118-
119+
119120
The curl equivalent of the above command:
120121
```bash
121122
curl \
@@ -126,7 +127,7 @@ Example commands to set up the environment:
126127
* By default, the method of authentication in Stronghold via Kubernetes API of the cluster on which Stronghold itself is running is enabled and configured under the name `kubernetes_local`. If you want to configure access via remote clusters, set the authentication path (`authPath`) and enable authentication and authorization in Stronghold via Kubernetes API for each cluster:
127128

128129
```bash
129-
stronghold auth enable -path=remote-kube-1 kubernetes
130+
d8 stronghold auth enable -path=remote-kube-1 kubernetes
130131
```
131132
The curl equivalent of the above command:
132133
```bash
@@ -140,22 +141,23 @@ Example commands to set up the environment:
140141
* Set the Kubernetes API address for each cluster (in this case, it is the K8s's API server service):
141142

142143
```bash
143-
stronghold write auth/remote-kube-1/config \
144+
d8 stronghold write auth/remote-kube-1/config \
144145
kubernetes_host="https://api.kube.my-deckhouse.com"
146+
disable_local_ca_jwt=true
145147
```
146148
The curl equivalent of the above command:
147149
```bash
148150
curl \
149151
--header "X-Vault-Token: ${VAULT_TOKEN}" \
150152
--request PUT \
151-
--data '{"kubernetes_host":"https://api.kube.my-deckhouse.com"}' \
153+
--data '{"kubernetes_host":"https://api.kube.my-deckhouse.com","disable_local_ca_jwt":true}' \
152154
${VAULT_ADDR}/v1/auth/remote-kube-1/config
153155
```
154156

155157
* Create a policy in Stronghold called `myapp-ro-policy` that allows reading of the `myapp-secret` secret:
156158

157159
```bash
158-
stronghold policy write myapp-ro-policy - <<EOF
160+
d8 stronghold policy write myapp-ro-policy - <<EOF
159161
path "demo-kv/data/myapp-secret" {
160162
capabilities = ["read"]
161163
}
@@ -180,7 +182,7 @@ Example commands to set up the environment:
180182
{{< /alert >}}
181183

182184
```bash
183-
stronghold write auth/kubernetes_local/role/myapp-role \
185+
d8 stronghold write auth/kubernetes_local/role/myapp-role \
184186
bound_service_account_names=myapp-sa \
185187
bound_service_account_namespaces=myapp-namespace \
186188
policies=myapp-ro-policy \
@@ -199,7 +201,7 @@ Example commands to set up the environment:
199201
* Repeat the same for the rest of the clusters, specifying a different authentication path:
200202

201203
```bash
202-
stronghold write auth/remote-kube-1/role/myapp-role \
204+
d8 stronghold write auth/remote-kube-1/role/myapp-role \
203205
bound_service_account_names=myapp-sa \
204206
bound_service_account_namespaces=myapp-namespace \
205207
policies=myapp-ro-policy \
@@ -215,10 +217,10 @@ Example commands to set up the environment:
215217
```
216218

217219

218-
{{< alert level="info">}}
219-
**Important!**
220-
The recommended TTL value of the Kubernetes token is 10m.
221-
{{< /alert >}}
220+
{{< alert level="info">}}
221+
**Important!**
222+
The recommended TTL value of the Kubernetes token is 10m.
223+
{{< /alert >}}
222224

223225
These settings allow any pod within the `myapp-namespace` namespace in both K8s clusters that uses the `myapp-sa` ServiceAccount to authenticate, authorize, and read secrets in the Stronghold according to the `myapp-ro-policy` policy.
224226

@@ -510,12 +512,31 @@ A container that uses the `subPath` volume mount will not get secret updates whe
510512
secretsStoreImport: "python-backend"
511513
```
512514

513-
## Get stronghold cli
515+
## Download the d8 multitool for stronghold commands
514516

515-
On the cluster's master node, run the following commands as `root`:
516-
```bash
517-
mkdir $HOME/bin
518-
sudo cp /proc/$(pidof stronghold)/root/usr/bin/stronghold bin && sudo chmod a+x bin/stronghold
519-
export PATH=$PATH:$HOME/bin
520-
```
521-
As a result, the command `stronhold` is ready to be used.
517+
### Official website of Deckhouse Kubernetes Platform
518+
519+
Go to the official website and follow the [instructions](https://deckhouse.io/products/kubernetes-platform/documentation/v1/deckhouse-cli/#how-do-i-install-deckhouse-cli).
520+
521+
### The subdomain of your Deckhouse Kubernetes Platform
522+
523+
To download the multitool:
524+
1. Go to the page `tools.<cluster_domain>`, where `<cluster_domain>` is the DNS name that matches the template defined in the [modules.publicDomainTemplate](deckhouse-configure-global.html#parameters-modules-publicdomaintemplate) parameter.
525+
526+
2. Select *Deckhouse CLI* for your operating system.
527+
1. **For Linux and MacOS:**
528+
- Add execution rights to `d8` via `chmod +x d8`.
529+
- Move the executable file to the `/usr/local/bin/` folder.
530+
531+
**For Windows:**
532+
- Extract the archive, move the `d8.exe` file to a directory of your choice, and add the directory to PATH variable of the operating system.
533+
- Unblock the `d8.exe file`, for example, in the following way:
534+
- Right-click on the file and select *Properties* from the context menu.
535+
- In the *Properties* window, ensure you are on the *General* tab.
536+
- At the bottom of the *General* tab, you may see a *Security* section with a message about the file being blocked.
537+
- Check the *Unblock* box or click the *Unblock* button, then click *Apply* and *OK* to save the changes.
538+
1. Check that the utility works:
539+
```
540+
d8 help
541+
```
542+
Congrats, you have successfully installed the `d8 stronhold`.

docs/USAGE_RU.md

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Использование модуля secrets-store-integration.
55

66
## Настройка модуля для работы c Deckhouse Stronghold
77

8-
Для автоматической настройки работы модуля secrets-store-integration в связке с модулем [Deckhouse Stronghold](../../stronghold/) потребуется ранее [включенный](../../stronghold/stable/usage.html#%D0%BA%D0%B0%D0%BA-%D0%B2%D0%BA%D0%BB%D1%8E%D1%87%D0%B8%D1%82%D1%8C) и настроенный Stronghold.
8+
Для автоматической настройки работы модуля secrets-store-integration в связке с модулем [Deckhouse Stronghold](../../stronghold/stable/) потребуется ранее [включенный](../../stronghold/stable/usage.html#%D0%BA%D0%B0%D0%BA-%D0%B2%D0%BA%D0%BB%D1%8E%D1%87%D0%B8%D1%82%D1%8C) и настроенный Stronghold.
99

1010
Далее достаточно применить следующий ресурс:
1111

@@ -65,7 +65,7 @@ export VAULT_ADDR=https://secretstoreexample.com
6565
```
6666
{{< /alert >}}
6767

68-
> В этом руководстве мы приводим два вида примерных команд:
68+
> В этом руководстве мы приводим два вида примерных команд:
6969
> * команда с использованием консольной версии Stronghold ([Как получить бинарный файл stronghold](#как-получить-бинарный-файл-stronghold));
7070
> * команда с использованием curl для выполнения прямых запросов в API secrets store.
7171

@@ -115,7 +115,7 @@ export VAULT_ADDR=https://secretstoreexample.com
115115
```bash
116116
stronghold kv get demo-kv/myapp-secret
117117
```
118-
118+
119119
Команда с использованием curl:
120120
```bash
121121
curl \
@@ -215,10 +215,10 @@ export VAULT_ADDR=https://secretstoreexample.com
215215
```
216216

217217

218-
{{< alert level="info">}}
219-
**Важно!**
220-
Рекомендованное значение TTL для токена Kubernetes составляет 10m.
221-
{{< /alert >}}
218+
{{< alert level="info">}}
219+
**Важно!**
220+
Рекомендованное значение TTL для токена Kubernetes составляет 10m.
221+
{{< /alert >}}
222222

223223
Эти настройки позволяют любому поду из пространства имён `myapp-namespace` из обоих K8s-кластеров, который использует ServiceAccount `myapp-sa`, аутентифицироваться и авторизоваться в Stronghold для чтения секретов согласно политике `myapp-ro-policy`.
224224

@@ -230,10 +230,10 @@ export VAULT_ADDR=https://secretstoreexample.com
230230

231231
## Как разрешить ServiceAccount авторизоваться в Stronghold?
232232

233-
Для авторизации в Stronghold, Pod использует токен, сгенерированный для своего ServiceAccount. Для того чтобы Stronghold мог проверить валидность предоставляемых данных ServiceAccount используемый сервисом, Stronghold должен иметь разрешение на действия `get`, `list` и `watch` для endpoints `tokenreviews.authentication.k8s.io` и `subjectaccessreviews.authorization.k8s.io`. Для этого также можно использовать clusterRole `system:auth-delegator`.
233+
Для авторизации в Stronghold Pod использует токен, сгенерированный для своего ServiceAccount. Для того чтобы Stronghold мог проверить валидность предоставляемых данных `ServiceAccount`, используемый сервисом Stronghold должен иметь разрешение на действия `get`, `list` и `watch` для endpoints `tokenreviews.authentication.k8s.io` и `subjectaccessreviews.authorization.k8s.io`. Для этого также можно использовать clusterRole `system:auth-delegator`.
234234

235235
Stronghold может использовать различные авторизационные данные для осуществления запросов в API Kubernetes:
236-
1. Использовать токен приложения, которое пытается авторизоваться в Stronghold. В этом случае для каждого сервиса авторизующейся в Stronghold требуется в используемом ServiceAccount иметь clusterRole `system:auth-delegator` (либо права на API представленные выше).
236+
1. Использовать токен приложения, которое пытается авторизоваться в Stronghold. В этом случае для каждого сервиса, авторизующегося в Stronghold, требуется в используемом ServiceAccount иметь clusterRole `system:auth-delegator` (либо права на API представленные выше).
237237
2. Использовать статичный токен отдельно созданного специально для Stronghold `ServiceAccount` у которого имеются необходимые права. Настройка Stronghold для такого случая подробно описана в [документации Vault](https://developer.hashicorp.com/vault/docs/auth/kubernetes#continue-using-long-lived-tokens).
238238

239239
## Инжектирование переменных окружения
@@ -506,12 +506,30 @@ for {
506506
secretsStoreImport: "python-backend"
507507
```
508508

509-
## Как получить бинарный файл stronghold
510-
511-
На мастер-ноде кластера необходимо выполнить следующие команды через `root` пользователя:
512-
```bash
513-
mkdir $HOME/bin
514-
sudo cp /proc/$(pidof stronghold)/root/usr/bin/stronghold bin && sudo chmod a+x bin/stronghold
515-
export PATH=$PATH:$HOME/bin
516-
```
517-
Команда `stronhold` готова к использованию.
509+
## Скачать мультитул d8 для команд Stronghold
510+
511+
### Официальный сайт Deckhouse Kubernetes Platform
512+
513+
Перейдите на официальный сайт и воспользуйтесь [инструкцией](https://deckhouse.ru/products/kubernetes-platform/documentation/v1/deckhouse-cli/#как-установить-deckhouse-cli)
514+
515+
### Субдомен вашей Deckhouse Kubernetes Platform
516+
517+
Для скачивания мультитула:
518+
1. Перейдите на страницу `tools..<cluster_domain>`, где `<cluster_domain>` — DNS-имя в соответствии с шаблоном из параметра [modules.publicDomainTemplate](deckhouse-configure-global.html#parameters-modules-publicdomaintemplate) глобальной конфигурации.
519+
1. Выберите Deckhouse CLI для вашей операционной системы.
520+
1. **Для Linux и MacOS:**
521+
- Добавьте права на выполнение `d8` через `chmod +x d8`.
522+
- Переместите исполняемый файл в каталог `/usr/local/bin/`.
523+
524+
**Для Windows:**
525+
- Распакуйте архив, переместите файл `d8.exe` в выбранный вами каталог и добавьте этот каталог в переменную $PATH операционной системы.
526+
- Разблокируйте файл `d8.exe`, например, следующим способом:
527+
- Щелкните правой кнопкой мыши на файле и выберите *Свойства* в контекстном меню.
528+
- В окне *Свойства* убедитесь, что находитесь на вкладке *Общие*.
529+
- Внизу вкладки *Общие* вы можете увидеть раздел *Безопасность* с сообщением о блокировке файла.
530+
- Установите флажок *Разблокировать* или нажмите кнопку *Разблокировать*, затем нажмите *Применить* и *ОК*, чтобы сохранить изменения.
531+
4. Проверьте, что утилита работает:
532+
```
533+
d8 help
534+
```
535+
Готово, вы установили `d8 stronghold`.

0 commit comments

Comments
 (0)