-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.yaml
138 lines (123 loc) · 10.7 KB
/
README.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
---
#
# This is the canonical configuration for the `README.md`
# Run `make readme` to rebuild the `README.md`
#
# Name of this project
name: "Confluent GitOps Demo"
# Short description of this project
description: |-
Fully automated Confluent Platform Demo which deploys Kafka in multiple namespaces and uses the TF Controller with Confluent Terraform Provider to provision Confluent Cloud resources. Acompanying slides can be found [here](https://www.slideshare.net/SionSmith1/oso-confluent-gitops-demo) The Demo will cover:
1. Minikube overview
2. Deploy GitOps toolkit
3. How to Install the Confluent Operator (CFK)
4. Connect GitOps Source Controller to GitHub repo
5. Deploy production kafka cluster via Flux
6. Deploy sandbox kafka cluster
7. How to Deploy Terraform Controller
8. Run Terraform to provision Confluent Cloud
# Canonical GitHub repo
github_repo: osodevops/confluent-gitops-demo
# How to use this project
usage: |-
Many teams are already using GitOps for application deployments and now we’ll show you how you can take GitOps even further by bootstrapping whole Confluent Platform include Confluent Cloud resources straight from a Git repository. In this demo we are using Flux, Kustomize and Helm to install and manage the [Confluent Operator for Kubernetes](https://docs.confluent.io/operator/current/overview.html)
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. With the Confluent Operator monitoring all namespaces in the cluster, we will then allow Flux to create two clusters, in separate namespaces. Production and Sandbox, each having a slightly different configuration and number of brokers to demonstrate the ability to easily override the base configuration.
Everyone can now easily spin up their clusters in 3 simple steps: **fork**, **clone**, and **run**
1. Fork: fork this Git repository so that you can work on it from your GitHub user account. Here’s the base repository https://github.com/osodevops/confluent-gitops-demo you can fork from.
2. Clone: do git clone to download your forked repository onto your machine.
3. Run: follow the instructions below to run and start your Kafka clusters.
The Toolkit components consist of Source Controller, Kustomize Controller, Helm Controller, Notification Controller and the Image Automation Controllers.
```
├── flux-system
│ ├── gotk-components.yaml
│ ├── gotk-sync.yaml
│ └── kustomization.yaml
├── kustomize
│ ├── base
│ │ ├── confluent
│ │ │ ├── connect
│ │ │ ├── control-centre
│ │ │ ├── kafka.yaml
│ │ │ ├── ksqldb
│ │ │ ├── kustomization.yaml
│ │ │ ├── schmea-registry
│ │ │ ├── secrets
│ │ │ └── zookeeper.yaml
│ │ └── kustomization.yaml
│ ├── environments
│ │ ├── kustomization.yaml
│ │ ├── production
│ │ └── sandbox
│ ├── operator
│ ├── terraform
│ └── tf-controller
```
# Example usage
examples: |-
### How to deploy this demo
#### 1. Create your Kubernetes cluster
Fork this repository into your own GitHub account.
#### 2. Create your Kubernetes cluster
We will be using MiniKube, but any remote cluster will work. Create the cluster using:
* Run `minikube start --cpus=6 --memory=20019 --kubernetes-version=v1.21.0`
#### 3. Deploy the GitOps toolkit
Toolkit CRDs and components are deployed using:
* Navigate to `./flux-system`
* Run `kubectl apply -f gotk-components.yaml`
#### 4. Create Confluent Cloud Credentials
Navigate to [Confluent Cloud API page](https://confluent.cloud/settings/api-keys) and generate a new set of API keys. Copy these and head over to your terminal to run:
* `export CONFLUENT_API_KEY=REPLACE_ME && export CONFLUENT_API_SECRET=REPLACE_ME
* run ./scripts/confluent-keys.sh
This will create a secret containing your keys which the Flux system can access when running Terraform via the TF Controller.
#### 5. Deploy Flux Sync
* Navigate to `./flux-system`
* run `kubectl apply -f gotk-sync.yaml`
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 which will monitor all namespaces for Confluent CRDs.
After a successful health check of the operator (which will run as a pod), Flux will then proceed to deploy the following Kustomizations:
* Production environment located at `./kustomize/environments/production`
* Sandbox environment located at `./kustomize/environments/sandbox`
* TF Controller for reconciling Terraform resources in the GitOps way located at `./kustomize/environments/tf-controller`
* Auto Apply Terraform using the variables located at `./kustomize/environments/terraform`
You should see the following output:
```console
gitrepository.source.toolkit.fluxcd.io/flux-system created
kustomization.kustomize.toolkit.fluxcd.io/confluent-infra created
kustomization.kustomize.toolkit.fluxcd.io/production created
kustomization.kustomize.toolkit.fluxcd.io/sandbox created
kustomization.kustomize.toolkit.fluxcd.io/terraform-controller created
kustomization.kustomize.toolkit.fluxcd.io/confluent-cloud created
```
#### 6. Let Flux work its magic
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:
```console
│ NAMESPACE NAME PF READY RESTARTS STATUS IP NODE AGE │
│ confluent confluent-operator-global-5fb8c9d5f8-82tqm ● 1/1 0 Running 172.17.0.11 minikube 6m39s │
│ flux-system helm-controller-544df4db67-5ghcd ● 1/1 0 Running 172.17.0.6 minikube 7m43s │
│ flux-system image-automation-controller-675bff6646-m8s5x ● 1/1 0 Running 172.17.0.4 minikube 7m43s │
│ flux-system image-reflector-controller-6bcddcfb44-dh4bv ● 1/1 0 Running 172.17.0.8 minikube 7m43s │
│ flux-system kustomize-controller-5b5bb9d49b-mh76j ● 1/1 0 Running 172.17.0.5 minikube 7m43s │
│ flux-system notification-controller-b55cbcf9c-jb8rh ● 1/1 0 Running 172.17.0.7 minikube 7m43s │
│ flux-system source-controller-6b6c7bc4bb-n29zd ● 1/1 0 Running 172.17.0.9 minikube 7m43s │
│ flux-system tf-controller-f65f5f4f5-vnrbl ● 1/1 0 Running 172.17.0.10 minikube 6m42s │
│ production connect-0 ● 1/1 0 Running 172.17.0.17 minikube 5m48s │
│ production controlcenter-0 ● 1/1 0 Running 172.17.0.13 minikube 5m49s │
│ production kafka-0 ● 1/1 0 Running 172.17.0.15 minikube 5m47s │
│ production kafka-1 ● 1/1 0 Running 172.17.0.22 minikube 5m47s │
│ production kafka-2 ● 1/1 0 Running 172.17.0.21 minikube 5m47s │
│ production schemaregistry-0 ● 1/1 0 Running 172.17.0.16 minikube 5m48s │
│ production zookeeper-0 ● 1/1 0 Running 172.17.0.20 minikube 5m47s │
│ production zookeeper-1 ● 1/1 0 Running 172.17.0.19 minikube 5m47s │
│ production zookeeper-2 ● 1/1 0 Running 172.17.0.18 minikube 5m47s │
│ sandbox kafka-0 ● 1/1 0 Running 172.17.0.12 minikube 5m49s │
│ sandbox zookeeper-0 ● 1/1 0 Running 172.17.0.14 minikube 5m48s │
```
related:
- name: "Terraform GitOps Example"
description: "A Terraform GitOps workflow showcasing how to use the TF-Controller to run your Terraform via GitOps"
url: "https://github.com/osodevops/terraform-gitops-example"
- name: "Kafka GitOps Example"
description: "A Kafka / Confluent GitOps workflow example for multi-env deployments with Flux, Kustomize, Helm and Confluent Operator"
url: "https://github.com/osodevops/kafka-gitops-examples"
- name: "Confluent Platform on Azure"
description: "Terraform Module for deploying best practice HA Confluent Platform on Azure"
url: "https://github.com/osodevops/terraform-azure-confluent-platform"