This repository is dedicated to managing Kubernetes clusters using GitOps principles. Below is the breakdown of its structure:
-
flux-system: Contains configuration for Flux, the GitOps operator.
- gotk-components.yaml: Defines Flux components.
- gotk-sync.yaml: Specifies synchronization settings.
- kustomization.yaml: Kustomization file for Flux system components.
-
simple-web-server-with-nodeport.yaml: YAML manifest for deploying a basic web server with a NodePort service.
-
weave-gitops-dashboard.yaml: YAML manifest for deploying the Weave GitOps Dashboard.
- Kubernetes cluster set up with Minikube or another solution.
- kubectl configured to interact with the cluster.
- Flux installed. Installation instructions can be found here.
-
Fork this repository with your preferred name.
-
Obtain a GitHub token as per the instructions here.
-
Export the GitHub token and your GitHub username as environment variables:
export GITHUB_TOKEN=<your token> export GITHUB_USER=<your user name> export GITHUB_REPO_NAME=<the name of this forked repo>
-
Bootstrap Flux on your GitHub repository:
flux bootstrap github \ --owner=$GITHUB_USER \ --repository=$GITHUB_REPO_NAME \ --branch=main \ --path=./clusters/my-cluster \ --personal
owner
refers to your GitHub username.repository
is the name of your repository.branch
indicates the branch to track.path
specifies the directory for GitOps manifests.- Use
--personal
for personal accounts. For organizations, replace it with--organization=<your organization>
.
You can expose services using the Weave GitOps Dashboard or directly through kubectl. For example:
To expose the Weave GitOps Dashboard:
kubectl port-forward svc/ww-gitops-weave-gitops -n flux-system 9001:9001
To expose nginx:
kubectl port-forward svc/my-nginx -n flux-system 8080:80
login with admin:password
For more information on Weave GitOps, refer to the documentation.