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
** This file was automatically generated by the `build-harness`.
16
+
** 1) Make all changes to `README.yaml`
17
+
** 2) Run `make init` (you only need to do this once)
18
+
** 3) Run`make readme` to rebuild this file.
19
+
**
20
+
** (We maintain HUNDREDS of open source projects. This is how we maintain our sanity.)
21
+
**
22
+
23
+
24
+
25
+
26
+
27
+
-->
28
+
A Kafka / Confluent GitOps workflow example for multi-env deployments with Flux, Kustomize, Helm and Confluent Operator
29
+
30
+
---
31
+
32
+
33
+
34
+
35
+
36
+
37
+
## Usage
2
38
3
39
For this example we assume a single cluster simulating a production confluent environment. The end goal is to leverage Flux and Kustomize to manage [Confluent Operator for Kubernetes](https://github.com/confluentinc/operator-earlyaccess). You can extend with another cluster while minimizing duplicated declarations.
4
40
@@ -8,11 +44,11 @@ Flux will monitor the Helm repository, and can be configured to automatically up
8
44
You may find this project helpful by simply referencing the documentation, code, and strategies for managing Kafka resources on Kubernetes. Additionally, if you just wish to operate a working example of the new Confluent operator, the following usage instructions will guide you.
9
45
10
46
11
-
## Repository structure
47
+
###Repository structure
12
48
13
49
The Git repository contains the following top directories:
14
50
15
-
-**flux-system** dir contains the required kubernetes resources for flux to operate
51
+
-**flux-system** dir contains the required kubernetes resources for flux to operate
16
52
-**kustomize/base** dir contains the base definition of the confluent stack.
17
53
-**kustomize/environments** dir containing an example environment, folders could be copied to create additional environments. Files within are 'patches' which are layered on top of the definitions found in kustomize/base
18
54
-**kustomize/operator** dir the helm chart definition for confluent-for-kubernetes (CFK).
@@ -28,11 +64,11 @@ The Git repository contains the following top directories:
28
64
│ └── operator
29
65
```
30
66
31
-
## Forking this repository.
67
+
###Forking this repository.
32
68
In order to showcase the GitOps behaviour of the FluxCD toolkit you will require the ability to write to a repository. Fork this repository, and update line 11 of the file `./flux-system/gotk-sync.yaml` to the new https git address of your forked repository. Also make note of line 10 'branch'; this is the branch of the repository which Flux will monitor
33
69
34
-
## Deploy base Flux components
35
-
### Overview
70
+
###Deploy base Flux components
71
+
####Overview
36
72
This step will install the base Flux kubernetes components onto your kubernetes cluster. To inspect what is being applied, simply look through the contents of `./flux-system/gotk-components.yaml`. You will see a mix of Custom Resource Definitions, Service Accounts, Deployments, and other various components. After the application of these resource definitions is completed, you should see the following pods running:
37
73
38
74
* Helm-Controller
@@ -43,20 +79,24 @@ This step will install the base Flux kubernetes components onto your kubernetes
43
79
For more information on what these controllers do, please review [the documentation here](https://fluxcd.io/docs/components/).
44
80
45
81
82
+
83
+
84
+
## Examples
85
+
46
86
### Deployment Process
47
87
* Navigate to `./flux-system`
48
88
* Run `kubectl apply -f gotk-components.yaml`
49
89
50
90
51
-
## Deploy Flux Sync
52
-
### Overview
91
+
###Deploy Flux Sync
92
+
####Overview
53
93
This next step will tell Flux what repository to monitor, and, within that repository, what kustomization files to start with. The first Kustomize resource that Flux will look for to is located at `./kustomize/operator`. This will install the confluent-for-kubernetes Helm chart. After a successful health check of the operator (which will run as a pod), Flux will then proceed to deploy our first environment located at `./kustomize/environments/sandbox`.
54
94
55
95
### Deployment Process
56
96
* Navigate to `./flux-system`
57
97
* run `kubectl apply -f gotk-sync.yaml`
58
98
59
-
## Watch Flux in action!
99
+
####Watch Flux in action!
60
100
Now that we have flux monitoring the forked Git repository, let's demonstrate the GitOps behaviour! If everything has deployed successfully, you should see a healthy confluent stack looking like this:
61
101
```console
62
102
│ NAME PF READY RESTARTS STATUS IP NODE AGE │
@@ -74,9 +114,9 @@ Now that we have flux monitoring the forked Git repository, let's demonstrate th
74
114
│
75
115
```
76
116
To exhibit Flux, let's change our kafka replicas from the default of 3, to 4:
77
-
* In the file `./kustomize/environments/sandbox/kafka.yaml` uncomment the line `# replicas: 4`, commit that change to your repository (git), and push upstream. The next time flux performs a 'sync' (observable in the 'source controller' logs), it will the change to the kafka spec, and in turn increase our kafka cluster from size '3' to '4'.
117
+
* In the file `./kustomize/environments/sandbox/kafka.yaml` uncomment the line `# replicas: 4`, commit that change to your repository (git), and push upstream. The next time flux performs a 'sync' (observable in the 'source controller' logs), it will the change to the kafka spec, and in turn increase our kafka cluster from size '3' to '4'.
78
118
79
-
## Develop Locally
119
+
###Develop Locally
80
120
If you want to test configuration out locally without the need to push up to git (i.e. testing locally with Minikube), the deployment can be replicated very simply:
81
121
82
122
* Navigate to `./flux-system`
@@ -93,3 +133,43 @@ If you want to test configuration out locally without the need to push up to git
93
133
* Run `kubectl apply -k .`
94
134
95
135
136
+
137
+
138
+
139
+
## Related Projects
140
+
141
+
Check out these related projects.
142
+
143
+
-[Confluent for Kubernetes (CFK) examples](https://github.com/osodevops/confluent-kubernetes-playground) - Playground for Kafka / Confluent Kubernetes experimentations
144
+
145
+
146
+
147
+
## Need some help
148
+
149
+
File a GitHub [issue](https://github.com/osodevops/kafka-gitops-examples/issues), send us an [email][email] or [tweet us][twitter].
[<imgsrc="https://oso-public-resources.s3.eu-west-1.amazonaws.com/oso-logo-green.png"alt="OSO who we are"width="250"/>](https://oso.sh/who-we-are/)
156
+
157
+
## Who we are
158
+
159
+
We at [OSO][website] help teams to adopt emerging technologies and solutions to boost their competitiveness, operational excellence and introduce meaningful innovations that drive real business growth. Our developer-first culture, combined with our cross-industry experience and battle-tested delivery methods allow us to implement the most impactful solutions for your business.
160
+
161
+
Looking for support applying emerging technologies in your business? We’d love to hear from you, get in touch by [email][email]
162
+
163
+
Start adopting new technologies by checking out [our other projects][github], [follow us on twitter][twitter], [join our team of leaders and challengers][careers], or [contact us][contact] to find the right technology to support your business.[![Beacon][beacon]][website]
# This is the canonical configuration for the `README.md`
4
+
# Run `make readme` to rebuild the `README.md`
5
+
#
6
+
7
+
# Name of this project
8
+
name: "Kafka GitOps Example"
9
+
10
+
# Short description of this project
11
+
description: |-
12
+
A Kafka / Confluent GitOps workflow example for multi-env deployments with Flux, Kustomize, Helm and Confluent Operator
13
+
14
+
# Canonical GitHub repo
15
+
github_repo: osodevops/kafka-gitops-examples
16
+
17
+
# How to use this project
18
+
usage: |-
19
+
For this example we assume a single cluster simulating a production confluent environment. The end goal is to leverage Flux and Kustomize to manage [Confluent Operator for Kubernetes](https://github.com/confluentinc/operator-earlyaccess). You can extend with another cluster while minimizing duplicated declarations.
20
+
21
+
We will configure [Flux](https://fluxcd.io/) to install, deploy and config the [Confluent Platform](https://www.confluent.io/product/confluent-platform) using their `HelmRepository` and `HelmRelease` custom resources.
22
+
Flux will monitor the Helm repository, and can be configured to automatically upgrade the Helm releases to their latest chart version based on semver ranges.
23
+
24
+
You may find this project helpful by simply referencing the documentation, code, and strategies for managing Kafka resources on Kubernetes. Additionally, if you just wish to operate a working example of the new Confluent operator, the following usage instructions will guide you.
25
+
26
+
27
+
### Repository structure
28
+
29
+
The Git repository contains the following top directories:
30
+
31
+
- **flux-system** dir contains the required kubernetes resources for flux to operate
32
+
- **kustomize/base** dir contains the base definition of the confluent stack.
33
+
- **kustomize/environments** dir containing an example environment, folders could be copied to create additional environments. Files within are 'patches' which are layered on top of the definitions found in kustomize/base
34
+
- **kustomize/operator** dir the helm chart definition for confluent-for-kubernetes (CFK).
35
+
36
+
37
+
```
38
+
├── flux-system
39
+
├── kustomize
40
+
│ ├── base
41
+
│ │ ├── confluent
42
+
│ ├── environments
43
+
│ │ └── sandbox
44
+
│ └── operator
45
+
```
46
+
47
+
### Forking this repository.
48
+
In order to showcase the GitOps behaviour of the FluxCD toolkit you will require the ability to write to a repository. Fork this repository, and update line 11 of the file `./flux-system/gotk-sync.yaml` to the new https git address of your forked repository. Also make note of line 10 'branch'; this is the branch of the repository which Flux will monitor
49
+
50
+
### Deploy base Flux components
51
+
#### Overview
52
+
This step will install the base Flux kubernetes components onto your kubernetes cluster. To inspect what is being applied, simply look through the contents of `./flux-system/gotk-components.yaml`. You will see a mix of Custom Resource Definitions, Service Accounts, Deployments, and other various components. After the application of these resource definitions is completed, you should see the following pods running:
53
+
54
+
* Helm-Controller
55
+
* Kustomize Controller
56
+
* Notification Controller
57
+
* Source Controller
58
+
59
+
For more information on what these controllers do, please review [the documentation here](https://fluxcd.io/docs/components/).
60
+
61
+
62
+
# Example usage
63
+
examples: |-
64
+
### Deployment Process
65
+
* Navigate to `./flux-system`
66
+
* Run `kubectl apply -f gotk-components.yaml`
67
+
68
+
69
+
### Deploy Flux Sync
70
+
#### Overview
71
+
This next step will tell Flux what repository to monitor, and, within that repository, what kustomization files to start with. The first Kustomize resource that Flux will look for to is located at `./kustomize/operator`. This will install the confluent-for-kubernetes Helm chart. After a successful health check of the operator (which will run as a pod), Flux will then proceed to deploy our first environment located at `./kustomize/environments/sandbox`.
72
+
73
+
### Deployment Process
74
+
* Navigate to `./flux-system`
75
+
* run `kubectl apply -f gotk-sync.yaml`
76
+
77
+
#### Watch Flux in action!
78
+
Now that we have flux monitoring the forked Git repository, let's demonstrate the GitOps behaviour! If everything has deployed successfully, you should see a healthy confluent stack looking like this:
To exhibit Flux, let's change our kafka replicas from the default of 3, to 4:
95
+
* In the file `./kustomize/environments/sandbox/kafka.yaml` uncomment the line `# replicas: 4`, commit that change to your repository (git), and push upstream. The next time flux performs a 'sync' (observable in the 'source controller' logs), it will the change to the kafka spec, and in turn increase our kafka cluster from size '3' to '4'.
96
+
97
+
### Develop Locally
98
+
If you want to test configuration out locally without the need to push up to git (i.e. testing locally with Minikube), the deployment can be replicated very simply:
99
+
100
+
* Navigate to `./flux-system`
101
+
* Run `kubectl apply -f gotk-components.yaml`
102
+
103
+
**instead of deploying the gotk-sync.yaml, we'll perform the kubectl kustomize applies ourselves.**
104
+
105
+
* Navigate to `./kustomize/operator`
106
+
* Run `kubectl apply -k .`
107
+
108
+
**monitor the running pods, wait until the 'confluent-operator' pod is in a running state**
109
+
110
+
* Navigate to `./kustomize/environments/`
111
+
* Run `kubectl apply -k .`
112
+
113
+
related:
114
+
- name: "Confluent for Kubernetes (CFK) examples"
115
+
description: "Playground for Kafka / Confluent Kubernetes experimentations"
0 commit comments