Skip to content

Commit 8673c90

Browse files
committed
ko: add docs for using KonnectAPIAuthConfiguration with Secrets
1 parent 5138a63 commit 8673c90

File tree

1 file changed

+52
-1
lines changed

1 file changed

+52
-1
lines changed

app/_how-tos/operator-konnect-getstarted-authentication.md

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,15 @@ prereqs:
3535

3636
## Create a `KonnectAPIAuthConfiguration` object
3737

38-
Depending on your preferences, you can create a `KonnectAPIAuthConfiguration` object with the token specified directly in the spec or as a reference to a Kubernetes Secret. In the CRD, the `serverURL` should be set to the {{site.konnect_short_name}} API url in the region where your account is located.
38+
Depending on your preferences, you can either:
3939

40+
- Create a `KonnectAPIAuthConfiguration` object with the token specified directly in the spec and use RBAC to restrict access to its type.
41+
- Or you can use a Kubernetes `Secret` (of type `Opaque`) and reference it from the `KonnectAPIAuthConfiguration` object.
42+
The token has to be specified in `Secret`'s `token` data field.
43+
44+
The `serverURL` should be set to the {{site.konnect_short_name}} API url in the region where your account is located.
45+
46+
### Using a token in `KonnectAPIAuthConfiguration`
4047

4148
<!-- vale off -->
4249
{% konnect_crd %}
@@ -50,6 +57,32 @@ spec:
5057
{% endkonnect_crd %}
5158
<!-- vale on -->
5259

60+
### Using a Secret reference
61+
62+
```yaml
63+
apiVersion: v1
64+
kind: Secret
65+
metadata:
66+
name: konnect-api-auth-secret
67+
namespace: default
68+
labels:
69+
konghq.com/secret: konnect
70+
stringData:
71+
token: '$KONNECT_TOKEN'
72+
```
73+
74+
<!-- vale off -->
75+
{% konnect_crd %}
76+
kind: KonnectAPIAuthConfiguration
77+
metadata:
78+
name: konnect-api-auth
79+
spec:
80+
type: secretRef
81+
secretRef:
82+
name: konnect-api-auth-secret
83+
serverURL: us.api.konghq.tech
84+
{% endkonnect_crd %}
85+
<!-- vale on -->
5386
5487
## Validate
5588
@@ -59,3 +92,21 @@ Run the following command to verify that the authentication configuration was cr
5992
kubectl get konnectapiauthconfiguration konnect-api-auth -n kong
6093
```
6194

95+
You should see output similar to the following:
96+
97+
```bash
98+
NAME VALID ORGID SERVERURL
99+
konnect-api-auth True 5ca26716-02f7-4430-9117-1d1a7a2695e7 https://us.api.konghq.tech
100+
```
101+
102+
If you prefer to work with status conditions programmatically, you can also run:
103+
104+
```bash
105+
kubectl get konnectapiauthconfiguration konnect-api-auth -n kong -o jsonpath="{.status.conditions[?(@.type=='APIAuthValid')]}"
106+
```
107+
108+
Which should yield the follow
109+
110+
```json
111+
{"lastTransitionTime":"2025-10-16T11:46:28Z","message":"Token is valid","observedGeneration":1,"reason":"Valid","status":"True","type":"APIAuthValid"}%
112+
```

0 commit comments

Comments
 (0)