Adds the practical elements for lesson 1 of the GitOps tutorial series. - #19
Adds the practical elements for lesson 1 of the GitOps tutorial series.#19alexcreasy wants to merge 4 commits into
Conversation
Signed-off-by: Alex Creasy <alex@creasy.dev>
|
How does the |
|
@tomncooper ahh yes, my mistake, that should have been removed in my cleanup step! I've removed it. |
Signed-off-by: Alex Creasy <alex@creasy.dev>
tomncooper
left a comment
There was a problem hiding this comment.
This is a good first instalment. I ran through lesson 00 and 01. It all works on Kind running in Podman on my Fedora 44 box.
I left some initial comments. You said the prose will be revised so I didn't dive to deep on that.
My only other comment is that it would be good to add a minikube deployment flow into the scripts as the combination of Kind and Minikube probably covers most of the local K8s dev installations.
| exit 1 | ||
| fi | ||
|
|
||
| if ! kubectl get kafka my-cluster -n kafka-tutorial &>/dev/null; then |
There was a problem hiding this comment.
The kafka cluster name and namespace should be parameterised and added to a common script file that all the tutorial scripts source.
| WORK_DIR=$(mktemp -d) | ||
| trap cleanup EXIT | ||
|
|
||
| git clone "http://${GITEA_USER}:${GITEA_PASSWORD}@localhost:${GITEA_HOST_PORT}/${GITEA_USER}/${GITEA_REPO}.git" "${WORK_DIR}/repo" 2>/dev/null |
There was a problem hiding this comment.
Should we build the git tea URL once in the common script to save doing it every time?
|
|
||
| ## Background: The GitOps idea in one paragraph | ||
|
|
||
| In traditional operations you make changes to a running system by running commands directly against it — `kubectl apply`, a config panel, an API call. GitOps flips this around: a Git repository is the single source of truth for what the system should look like. A tool (in this case ArgoCD) watches the repository and continuously reconciles the live system to match. If Git says a topic should exist, the topic exists. If you remove it from Git, it disappears from the cluster. You never touch the system directly; you only change Git. |
There was a problem hiding this comment.
| In traditional operations you make changes to a running system by running commands directly against it — `kubectl apply`, a config panel, an API call. GitOps flips this around: a Git repository is the single source of truth for what the system should look like. A tool (in this case ArgoCD) watches the repository and continuously reconciles the live system to match. If Git says a topic should exist, the topic exists. If you remove it from Git, it disappears from the cluster. You never touch the system directly; you only change Git. | |
| In traditional operations you make changes to a running system by running commands directly against it — `kubectl apply`, a config panel, an API call. GitOps flips this around: a Git repository is the single source of truth for what the system should look like. A tool (in this case ArgoCD) watches the repository and continuously reconciles the live system to match. If the config in the git repository says a topic should exist, then the topic will be created. If you remove it from the config repository, it disappears from the cluster. You never touch the system directly; you only change the configuration in the repo. You now have, thanks to git, a record of all the changes made, when they were made and by who. You can also setup all kinds of sanity and safety checks to run against those changes before they are applied. |
| cat manifests/kafka.yaml | ||
| ``` | ||
|
|
||
| That YAML file, committed to the Git repository, is the complete description of this Kafka cluster. ArgoCD read it from Git and the Strimzi operator created the cluster from it. You didn't run any `kubectl apply` commands — the setup script pushed the file to Git and ArgoCD took it from there. |
There was a problem hiding this comment.
| That YAML file, committed to the Git repository, is the complete description of this Kafka cluster. ArgoCD read it from Git and the Strimzi operator created the cluster from it. You didn't run any `kubectl apply` commands — the setup script pushed the file to Git and ArgoCD took it from there. | |
| That YAML file, committed to the Git repository, is the complete description of this Kafka cluster. ArgoCD read it from the repo, applied to the kubernetes cluster and the Strimzi operator created the Kafka cluster from it. You didn't run any `kubectl apply` commands — the setup script pushed the file to the Git repo and ArgoCD took it from there. |
| kubectl get kafkatopic -n kafka-tutorial | ||
| ``` | ||
|
|
||
| You should see no topics listed (or only internal Strimzi housekeeping topics). There is no application topic yet. |
There was a problem hiding this comment.
I wouldn't expect any housekeeping topics there? The TopicOperator only does one-way sync from k8s > Kafka, it won't create KafkaTopic CRs for topics in kafka which aren't in k8s.
I wonder if we should use the actual kafka topic commands here to interrogate the kafka cluster directly and show there are currently no topics?
Something like:
kubectl -n kafka-tutorial exec -it my-cluster-combined-0 -- bin/kafka-topics.sh --bootstrap-server my-cluster-kafka-bootstrap:9092 --listSigned-off-by: Alex Creasy <alex@creasy.dev>
Signed-off-by: Alex Creasy <alex@creasy.dev>
NOTE: This PR is first in a stack of 3 PRs and must be merged before the others:
This adds the first lesson for the GitOps tutorial series.
To run
Checkout the README.md in the
lessons/directory which will point you to instructions to setup the infrastructure and then to the first lesson.Note: the documentation is to give an idea of how the lesson will go. In a later PR the prose will be re-written to improve the flow, make them more engaging and better elaborate on the lessons as required.
Closes: #8