You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[A `1password-credentials.json` file generated and a 1Password Connect API Token issued for the K8s Operator integration](https://developer.1password.com/docs/connect/get-started/#step-1-set-up-a-secrets-automation-workflow)
21
-
22
-
## Deploying 1Password Connect to Kubernetes
23
-
24
-
If 1Password Connect is already running, you can skip this step.
25
-
26
-
There are options to deploy 1Password Connect:
27
-
28
-
-[Deploy with Helm](#deploy-with-helm)
29
-
-[Deploy using the Connect Operator](#deploy-using-the-connect-operator)
30
-
31
-
### Deploy with Helm
32
-
33
-
The 1Password Connect Helm Chart helps to simplify the deployment of 1Password Connect and the 1Password Connect Kubernetes Operator to Kubernetes.
34
-
35
-
[The 1Password Connect Helm Chart can be found here.](https://github.com/1Password/connect-helm-charts)
36
-
37
-
### Deploy using the Connect Operator
23
+
---
38
24
39
-
This guide will provide a quickstart option for deploying a default configuration of 1Password Connect via starting the deploying the 1Password Connect Operator, however, it is recommended that you instead deploy your own manifest file if customization of the 1Password Connect deployment is desired.
25
+
## Configuration options
26
+
There are 2 ways 1Password Operator can talk to 1Password servers:
27
+
-[1Password Service Accounts](https://developer.1password.com/docs/service-accounts)
Encode the `1password-credentials.json` file you generated in the prerequisite steps and save it to a file named `op-session`:
30
+
---
42
31
43
-
```bash
44
-
cat 1password-credentials.json | base64 | \
45
-
tr '/+''_-'| tr -d '='| tr -d '\n'> op-session
46
-
```
32
+
## Use Kubernetes Operator with Service Account
47
33
48
-
Create a Kubernetes secret from the op-session file:
34
+
### 1. [Create a service account](https://developer.1password.com/docs/service-accounts/get-started#create-a-service-account)
35
+
### 2. Create a Kubernetes secret for the Service Account
36
+
- Set `OP_SERVICE_ACCOUNT_TOKEN` environment variable to the service account token you created in the previous step. This token will be used by the operator to access 1Password items.
Add the following environment variable to the onepassword-connect-operator container in `/config/manager/manager.yaml`:
43
+
### 3. Deploy the Operator
55
44
56
-
```yaml
57
-
- name: MANAGE_CONNECT
58
-
value: "true"
59
-
```
60
-
61
-
Adding this environment variable will have the operator automatically deploy a default configuration of 1Password Connect to the current namespace.
45
+
An sample Deployment yaml can be found at `/config/manager/manager.yaml`.
46
+
To use Operator with Service Account, you need to set the `OP_SERVICE_ACCOUNT_TOKEN` environment variable in the `/config/manager/manager.yaml`. And remove `OP_CONNECT_TOKEN` and `OP_CONNECT_HOST` environment variables.
62
47
63
-
### Kubernetes Operator Deployment
48
+
To further configure the 1Password Kubernetes Operator the following Environment variables can be set in the operator yaml:
64
49
65
-
#### Create Kubernetes Secret for OP_CONNECT_TOKEN ####
50
+
-**OP_SERVICE_ACCOUNT_TOKEN***(required)*: Specifies Service Account token within Kubernetes to access the 1Password items.
51
+
-**WATCH_NAMESPACE:***(default: watch all namespaces)*: Comma separated list of what Namespaces to watch for changes.
52
+
-**POLLING_INTERVAL***(default: 600)*: The number of seconds the 1Password Kubernetes Operator will wait before checking for updates from 1Password.
53
+
-**AUTO_RESTART** (default: false): If set to true, the operator will restart any deployment using a secret from 1Password. This can be overwritten by namespace, deployment, or individual secret. More details on AUTO_RESTART can be found in the ["Configuring Automatic Rolling Restarts of Deployments"](#configuring-automatic-rolling-restarts-of-deployments) section.
66
54
67
-
Create a Connect token for the operator and save it as a Kubernetes Secret:
55
+
To deploy the operator, simply run the following command:
To further configure the 1Password Kubernetes Operator the following Environment variables can be set in the operator yaml:
84
75
@@ -88,89 +79,42 @@ To further configure the 1Password Kubernetes Operator the following Environment
88
79
-**MANAGE_CONNECT***(default: false)*: If set to true, on deployment of the operator, a default configuration of the OnePassword Connect Service will be deployed to the current namespace.
89
80
-**AUTO_RESTART** (default: false): If set to true, the operator will restart any deployment using a secret from 1Password Connect. This can be overwritten by namespace, deployment, or individual secret. More details on AUTO_RESTART can be found in the ["Configuring Automatic Rolling Restarts of Deployments"](#configuring-automatic-rolling-restarts-of-deployments) section.
90
81
91
-
You can also set the logging level by setting `--zap-log-level` as an arg on the containers to either `debug`, `info` or `error`. (Note: the default value is `debug`.)
82
+
---
83
+
84
+
## Logging level
85
+
You can set the logging level by setting `--zap-log-level` as an arg on the containers to either `debug`, `info` or `error`. The default value is `debug`.
92
86
93
87
Example:
94
88
```yaml
95
-
.
96
-
.
97
-
.
89
+
....
98
90
containers:
99
91
- command:
100
92
- /manager
101
93
args:
102
94
- --leader-elect
103
95
- --zap-log-level=info
104
96
image: 1password/onepassword-operator:latest
105
-
.
106
-
.
107
-
.
97
+
....
108
98
```
109
-
To deploy the operator, simply run the following command:
110
99
111
-
```shell
112
-
make deploy
113
-
```
114
-
115
-
**Undeploy Operator**
116
-
117
-
```
118
-
make undeploy
119
-
```
120
-
121
-
## Usage
122
-
123
-
To create a Kubernetes Secret from a 1Password item, create a yaml file with the following
124
-
125
-
```yaml
126
-
apiVersion: onepassword.com/v1
127
-
kind: OnePasswordItem
128
-
metadata:
129
-
name: <item_name> #this name will also be used for naming the generated kubernetes secret
Applying this yaml file will create a Kubernetes Secret with the name `<secret_name>` and contents from the location specified at the specified Item Path.
107
+
## How 1Password Items Map to Kubernetes Secrets
161
108
162
109
The contents of the Kubernetes secret will be key-value pairs in which the keys are the fields of the 1Password item and the values are the corresponding values stored in 1Password.
163
110
In case of fields that store files, the file's contents will be used as the value.
164
111
165
112
Within an item, if both a field storing a file and a field of another type have the same name, the file field will be ignored and the other field will take precedence.
166
113
167
-
**Note:** Deleting the Deployment that you've created will automatically delete the created Kubernetes Secret only if the deployment is still annotated with `operator.1password.io/item-path` and `operator.1password.io/item-name` and no other deployment is using the secret.
114
+
Deleting the Deployment that you've created will automatically delete the created Kubernetes Secret only if the deployment is still annotated with `operator.1password.io/item-path` and `operator.1password.io/item-name` and no other deployment is using the secret.
168
115
169
116
If a 1Password Item that is linked to a Kubernetes Secret is updated within the POLLING_INTERVAL the associated Kubernetes Secret will be updated. However, if you do not want a specific secret to be updated you can add the tag `operator.1password.io:ignore-secret` to the item stored in 1Password. While this tag is in place, any updates made to an item will not trigger an update to the associated secret in Kubernetes.
170
117
171
-
---
172
-
173
-
**NOTE**
174
118
175
119
If multiple 1Password vaults/items have the same `title` when using a title in the access path, the desired action will be performed on the oldest vault/item.
176
120
@@ -237,6 +181,8 @@ metadata:
237
181
238
182
If the value is not set, the auto restart settings on the deployment will be used.
0 commit comments