Skip to content

Commit 75d0446

Browse files
authored
fix Crossplane integration guide (#438)
1 parent 713287e commit 75d0446

2 files changed

Lines changed: 108 additions & 39 deletions

File tree

docs/content/usage/integrations/cert-manager.md

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,25 @@ weight: 10
77

88
# Cert-Manager Integration
99

10-
1. **Install cert-manager** in your Kubernetes cluster, where kube-bind backend is running, if you haven't already. You can follow the official installation guide [here](https://cert-manager.io/docs/installation/kubernetes/).
10+
## Setup
1111

12-
2. **Add kube-bind export label** to certificate CRD.
12+
The following sections will guide you through the one-time setup that is required for providing
13+
certificates using cert-manager and kube-bind.
14+
15+
### Install cert-manager
16+
17+
Install cert-manager in your Kubernetes cluster, where kube-bind backend is running, if you haven't
18+
already. You can follow the [official installation guide](https://cert-manager.io/docs/installation/kubernetes/).
19+
20+
### Export the Certificate CRD
21+
22+
To export the cert-manager `Certificate` CRD, add the kube-bind export label to it:
1323

1424
```bash
1525
kubectl label crd certificates.cert-manager.io kube-bind.io/exported=true --overwrite
1626
```
1727

18-
3. **Create SelfSigned issuer** in the provider cluster.
28+
### Create a SelfSigned Issuer
1929

2030
```yaml
2131
kubectl apply -f - <<EOF
@@ -28,7 +38,10 @@ spec:
2838
EOF
2939
```
3040

31-
4. **Create a `kube-bind` template for `Certificate` resources** to allow service consumers to request TLS certificates. Below is an example template:
41+
### Create a APIServiceExportTemplate
42+
43+
It's now time to configure kube-bind to export the certificate resource. To do so, create a
44+
kube-bind `APIServiceExportTemplate` for `Certificate` resources like this one:
3245

3346
```yaml
3447
kubectl apply -f - <<EOF
@@ -57,15 +70,31 @@ spec:
5770
EOF
5871
```
5972

60-
5. **Login into the kube-bind CLI** and request a binding to the `certificate` template created above. This will allow you to create `Certificate` resources in your consumer cluster.
73+
## Usage
74+
75+
Now that everything is set up, users can begin to bind to your backend and begin consuming the new
76+
API.
77+
78+
### Login to kube-bind
6179

6280
```bash
6381
kubectl bind login https://kube-bind.example.com
82+
```
83+
84+
### Request a Binding
85+
86+
Request a binding to the `certificate` template created above. This will allow you to create
87+
`Certificate` objects in your consumer cluster.
88+
89+
```bash
6490
# you will get redirected to UI to authenticate and pick the template
6591
kubectl bind
6692
```
6793

68-
6. **Wait for the binding to be established.** Once the binding is active, you can create `Certificate` resources in your consumer cluster, and you will get `Certificate` objects synced from the provider cluster.
94+
### Wait for the Binding to be Established
95+
96+
Once the binding is active, you can create `Certificate` objects in your consumer cluster, and you
97+
will get `Certificate` objects synced from the provider cluster.
6998

7099
```bash
71100
kubectl bind
@@ -87,10 +116,13 @@ Created 1 APIServiceBinding(s):
87116
Resources bound successfully!
88117
```
89118

90-
7. **Create a `Certificate` resource** in your consumer cluster. The cert-manager in the provider cluster will handle the issuance and management of the TLS certificate.
119+
### Create a Certificate
120+
121+
Now you can finally create a `Certificate` object in your consumer cluster. The cert-manager in the
122+
provider cluster will handle the issuance and management of the TLS certificate.
91123

92124
!!! note
93-
my-selfsigned-issuer must be present in the provider cluster for this example to work.
125+
`my-selfsigned-issuer` must be present in the provider cluster for this example to work.
94126

95127
```yaml
96128
kubectl apply -f - <<EOF
@@ -109,12 +141,16 @@ spec:
109141
EOF
110142
```
111143

112-
8. Observe that the `Certificate` resource is created in the consumer cluster and the corresponding TLS secret is generated.
144+
### Wait for Provisioning
145+
146+
Observe that the `Certificate` object is created in the consumer cluster and the corresponding TLS
147+
Secret is generated:
113148

114149
```bash
115150
kubectl get certificates
116151
NAME READY SECRET AGE
117152
my-tls-cert True my-tls-cert 6m55s
153+
118154
kubectl get secrets
119155
NAME TYPE DATA AGE
120156
my-tls-cert kubernetes.io/tls 3 6m33s

docs/content/usage/integrations/crossplane.md

Lines changed: 63 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,27 @@ weight: 20
77

88
# Crossplane Integration
99

10-
This document provides an example deployment walkthrough showing how to integrate kube-bind with Crossplane and how to deploy a sample managed MySQL resource using two kind clusters: a provider cluster (where Crossplane runs and kube-bind backend to export APIs) and a consumer cluster (which allows to bind those APIs using kube-bind konnector).
10+
This document provides an example deployment walkthrough showing how to integrate kube-bind with
11+
Crossplane and how to deploy a sample managed MySQL resource using two kind clusters: a provider
12+
cluster (where Crossplane runs and kube-bind backend to export APIs) and a consumer cluster (which
13+
allows to bind those APIs using kube-bind konnector).
1114

1215
!!! note
13-
Currently for permission claims to work properly, it is required to run namespaced Crossplane resources.
14-
16+
Currently for permission claims to work properly, it is required to run namespaced Crossplane
17+
resources.
1518

1619
![Crossplane example architecture diagram](crossplane.png)
1720

18-
1. **Install Crossplane** in your Kubernetes cluster where the kube-bind backend will run.
19-
You can follow the official installation guide [here](https://docs.crossplane.io/v2.1/get-started/install).
21+
## Setup
22+
23+
The following sections will guide you through the one-time setup that is required for providing
24+
MySQL databases using Crossplane and kube-bind.
25+
26+
### Install Crossplane
27+
28+
Install Crossplace in your Kubernetes cluster where the kube-bind backend will run. You can follow
29+
the [official installation guide](https://docs.crossplane.io/v2.1/get-started/install) from the
30+
Crossplane documentation.
2031

2132
```bash
2233
helm repo add crossplane-stable https://charts.crossplane.io/stable
@@ -27,9 +38,9 @@ helm install crossplane crossplane-stable/crossplane \
2738
--create-namespace
2839
```
2940

30-
2. **Install a Crossplane provider-sql**
41+
### Install Crossplane provider-sql
3142

32-
In the example, we will set up mysql database:
43+
In this example, we will set up MySQL database:
3344

3445
```yaml
3546
kubectl apply -f - <<EOF
@@ -55,10 +66,10 @@ spec:
5566
EOF
5667
```
5768

69+
### Setup the MySQL Deployment
5870

59-
3. **Set up the mysql deployment in the provider cluster**
60-
61-
Create and set up Deployment, PersistentVolume, PersistentVolumeClaim and Service for MySQL instance
71+
Create and set up `Deployment`, `PersistentVolume`, `PersistentVolumeClaim` and `Service` for the
72+
MySQL instance.
6273

6374
```yaml
6475
kubectl apply -f - <<EOF
@@ -135,9 +146,9 @@ spec:
135146
EOF
136147
```
137148

138-
4. **Create a Crossplane XRD and Composition for a managed MySQL database**
149+
### Configure Crossplane
139150

140-
Apply both manifests:
151+
Time to create a Crossplane XRD and Composition for a managed MySQL database. Apply both manifests:
141152

142153
```yaml
143154
kubectl apply -f - <<EOF
@@ -181,6 +192,7 @@ spec:
181192
EOF
182193
```
183194

195+
{% raw %}
184196
```yaml
185197
kubectl apply -f - <<'EOF'
186198
apiVersion: apiextensions.crossplane.io/v1
@@ -317,9 +329,11 @@ spec:
317329
step: create-mysql-resources
318330
EOF
319331
```
332+
{% endraw %}
333+
334+
### Export the Database API
320335

321-
5. **Export the database API using kube-bind.**
322-
Create an APIServiceExportTemplate for the mysqldatabase.mangodb.com resource:
336+
Create an `APIServiceExportTemplate` for the `mysqldatabase.mangodb.com` resource:
323337

324338
```yaml
325339
kubectl apply -f - <<EOF
@@ -344,16 +358,28 @@ spec:
344358
EOF
345359
```
346360

347-
6. **Login to kube-bind and request a binding to the exported database API.**
361+
## Usage
348362

349-
```bash
350-
kubectl bind login https://kube-bind.example.com
351-
# Authenticate and select the mysqldatabase export
352-
kubectl bind
353-
```
363+
Now that everything is set up, users can begin to bind to your backend and begin consuming the new
364+
API.
354365

366+
### Login to kube-bind
355367

356-
7. **Wait for the binding to be established.** Once the binding is active, you can create `MySQLDatabase` resources in your consumer cluster, and you will get `MySQLDatabase` objects synced from the provider cluster.
368+
```bash
369+
kubectl bind login https://kube-bind.example.com
370+
```
371+
372+
### Request a Binding
373+
374+
```bash
375+
# Authenticate and select the mysqldatabase export
376+
kubectl bind
377+
```
378+
379+
### Wait for the Binding to be Established
380+
381+
Once the binding is active, you can create `MySQLDatabase` resources in your consumer cluster,
382+
and you will get `MySQLDatabase` objects synced from the provider cluster.
357383

358384
```bash
359385
kubectl bind
@@ -373,14 +399,17 @@ Created 1 APIServiceBinding(s):
373399
Resources bound successfully!
374400
```
375401

376-
8. **Create a managed database in your consumer cluster.**
377-
Verify that mysqldatabases.mangodb.com CRD is synced to the consumer cluster:
402+
### Create a Managed Database
403+
404+
Verify that a `mysqldatabases.mangodb.com` CRD is synced to the consumer cluster:
405+
378406
```bash
379407
k get crd mysqldatabases.mangodb.com
380408
NAME CREATED AT
381409
mysqldatabases.mangodb.com 2025-11-27T14:22:18Z
382410
```
383-
Order a new consumer-database instance in the provider cluster
411+
412+
Order a new consumer database instance in the provider cluster:
384413

385414
```yaml
386415
kubectl apply -f - <<EOF
@@ -394,7 +423,10 @@ spec:
394423
EOF
395424
```
396425

397-
9. **Observe the provisioned database and connection secret in the provider cluster.**
426+
### Wait for Provisioning
427+
428+
The kube-bind konnector and the CloudNativePG operator should now be busy provisioning your
429+
database. You can observe the provisioned database and connection Secret in the provider cluster:
398430

399431
```bash
400432
kubectl get mysqldatabases.mangodb.com kube-bind-bp52k-consumer-database
@@ -415,6 +447,7 @@ kube-bind-bp52k-consumer-database-credentials Opaque
415447
```bash
416448
kubectl get mysqldatabases.mangodb.com kube-bind-bp52k-consumer-database -o yaml
417449
```
450+
418451
```yaml
419452
apiVersion: mangodb.com/v1
420453
kind: MySQLDatabase
@@ -472,18 +505,18 @@ status:
472505
ready: true
473506
```
474507
475-
You should see your MySQL instance created in the provider cluster and a secret with connection details, once Crossplane finishes provisioning of the database.
508+
You should see your MySQL instance created in the provider cluster and a secret with connection
509+
details, once Crossplane finishes provisioning of the database.
476510
477-
Observe that the requested secret with connection details for user is synced to consumer cluster.
511+
Observe that the requested Secret with connection details for user is synced to consumer cluster.
478512
479513
```bash
480514
kubectl get secrets
481515

482-
NAMESPACE NAME TYPE DATA AGE
483-
default consumer-database-credentials Opaque 4 5m21s
516+
NAMESPACE NAME TYPE DATA AGE
517+
default consumer-database-credentials Opaque 4 5m21s
484518
```
485519

486-
487520
---
488521

489522
For troubleshooting and more information, check the [kube-bind documentation](https://kube-bind.io/docs/).

0 commit comments

Comments
 (0)