Skip to content

Commit dc164ca

Browse files
authored
Document API key setup and add details about secret creation (#160)
<!--- Note to EXTERNAL Contributors --> <!-- Thanks for opening a PR! If it is a significant code change, please **make sure there is an open issue** for this. We work best with you when we have accepted the idea first before you code. --> <!--- For ALL Contributors 👇 --> ## What was changed Document API key setup and add details about secret creation ## Why? Not previously documented ## Checklist <!--- add/delete as needed ---> 1. Closes <!-- add issue number here --> 2. How was this tested: <!--- Please describe how you tested your changes/how we can test them --> 3. Any docs updates needed? <!--- update README if applicable or point out where to update docs.temporal.io -->
1 parent d0c1641 commit dc164ca

File tree

1 file changed

+125
-1
lines changed

1 file changed

+125
-1
lines changed

docs/configuration.md

Lines changed: 125 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ workerOptions:
159159
160160
### Connection Configuration
161161
162-
Reference a `TemporalConnection` resource that defines server details:
162+
Reference a `TemporalConnection` resource that defines server details. You can use either mutual TLS (mTLS) or API key authentication, but not both.
163+
164+
**Using mTLS Authentication:**
163165

164166
```yaml
165167
apiVersion: temporal.io/v1alpha1
@@ -171,6 +173,128 @@ spec:
171173
mutualTLSSecretRef:
172174
name: temporal-cloud-mtls # Optional: for mTLS
173175
```
176+
**Creating an mTLS Secret:**
177+
178+
The mTLS secret must be of type `kubernetes.io/tls` and contain `tls.crt` (certificate) and `tls.key` (private key) keys.
179+
180+
<details>
181+
<summary>Show detailed creation steps</summary>
182+
183+
**Option 1: Using kubectl from existing files:**
184+
185+
If you already have your certificate and key files:
186+
187+
```bash
188+
kubectl create secret tls temporal-cloud-mtls \
189+
--cert=/path/to/certificate.pem \
190+
--key=/path/to/private-key.key \
191+
--namespace=your-namespace
192+
```
193+
194+
**Option 2: Using kubectl with literal base64-encoded values:**
195+
196+
```bash
197+
kubectl create secret tls temporal-cloud-mtls \
198+
--cert=<(echo -n "$CERTIFICATE_CONTENT") \
199+
--key=<(echo -n "$KEY_CONTENT") \
200+
--namespace=your-namespace
201+
```
202+
203+
**Option 3: Creating via YAML manifest:**
204+
205+
```yaml
206+
apiVersion: v1
207+
kind: Secret
208+
metadata:
209+
name: temporal-cloud-mtls
210+
namespace: your-namespace
211+
type: kubernetes.io/tls
212+
data:
213+
# Base64-encoded certificate
214+
tls.crt: LS0tLS1CRUdJTi...
215+
# Base64-encoded private key
216+
tls.key: LS0tLS1CRUdJTi...
217+
```
218+
219+
To generate the base64-encoded values:
220+
221+
```bash
222+
# For tls.crt
223+
cat certificate.pem | base64 -w 0
224+
225+
# For tls.key
226+
cat private-key.key | base64 -w 0
227+
```
228+
229+
</details>
230+
231+
**Using API Key Authentication:**
232+
233+
```yaml
234+
apiVersion: temporal.io/v1alpha1
235+
kind: TemporalConnection
236+
metadata:
237+
name: production-temporal
238+
spec:
239+
hostPort: "production.abc123.tmprl.cloud:7233"
240+
apiKeySecretRef:
241+
name: temporal-api-key # Name of the Secret
242+
key: api-key # Key within the Secret containing the API key token
243+
```
244+
245+
**Creating an API Key Secret:**
246+
247+
The API key secret must be of type `kubernetes.io/opaque` (or you can omit the type field). The API key token should be stored under a key of your choice.
248+
249+
<details>
250+
<summary>Show detailed creation steps</summary>
251+
252+
**Option 1: Using kubectl with literal value:**
253+
254+
```bash
255+
kubectl create secret generic temporal-api-key \
256+
--from-literal=api-key=your-api-key-token-here \
257+
--namespace=your-namespace
258+
```
259+
260+
**Option 2: Using kubectl from a file:**
261+
262+
If your API key is stored in a file:
263+
264+
```bash
265+
kubectl create secret generic temporal-api-key \
266+
--from-file=api-key=/path/to/api-key-file.txt \
267+
--namespace=your-namespace
268+
```
269+
270+
**Option 3: Creating via YAML manifest:**
271+
272+
```yaml
273+
apiVersion: v1
274+
kind: Secret
275+
metadata:
276+
name: temporal-api-key
277+
namespace: your-namespace
278+
type: kubernetes.io/opaque
279+
data:
280+
# Base64-encoded API key token
281+
# The key name here must match the 'key' field in apiKeySecretRef
282+
api-key: eW91ci1hcGkta2V5LXRva2VuLWhlcmU=
283+
```
284+
285+
To generate the base64-encoded value:
286+
287+
```bash
288+
echo -n "your-api-key-token-here" | base64
289+
```
290+
291+
</details>
292+
293+
**Important Notes:**
294+
- Both secrets must be created in the same Kubernetes namespace as the `TemporalConnection` resource
295+
- Only one authentication method can be specified per `TemporalConnection` (either `mutualTLSSecretRef` or `apiKeySecretRef`)
296+
- The secret name and key in `apiKeySecretRef` must match the actual Secret resource and data key
297+
- For mTLS secrets, the keys must be named exactly `tls.crt` and `tls.key`
174298

175299
## Gate Configuration
176300

0 commit comments

Comments
 (0)