Guide to gain hands-on experience with GitOps using k3d Kubernetes cluster We will use k3d for Kubernetes
-
Create workspace directory and clone git repo
WORKPSACE_PATH="$HOME/workspace/gitops" GIT_REPO_PATH="$HOME/workspace/gitops/gitops-experiments" [ ! -d $WORKPSACE_PATH ] && mkdir -p $WORKPSACE_PATH [ ! -d $GIT_REPO_PATH ] && git clone https://github.com/rajasoun/gitops-experiments $WORKPSACE_PATH
-
Setup local development environment for k3d
Default local kubernetes cluster is k3d. To use kind, set
export KUBERNETES_TYPE=kindbefore runningsetupcommand.local-dev/assist.sh setup
Kubernetes 10 minutes Refresher
-
Test local development environment
local-dev/assist.sh test -
Check the status of the local development environment
local-dev/assist.sh status
./assist.sh setup installs prerequisites tools, k3d cluster and populate .env file. It does the following:
- Build .env file and populate it with required values, using
iaac/env/env.sh setup - Installs required devops-tools using homebrew, using
iaac/prerequisites/prerequisite.sh setup - Builds Kubernetes cluster using k3d, using
iaac/k3d/k3d.sh setup - Perform customization to the k9s, using
iaac/devops-tools/k9s/customize.sh setup
./assist.sh test tests the correctness of the cluster. It does the following:
- Test prerequisite, using
iaac/prerequisites/prerequisite.sh test - Test Kubernetes cluster using,
iaac/kubernetes/k3d/k3d.sh test - Test k9s customization using
iaac/devops-tools/k9s/customize.sh test
./assist.sh status checks the status of the local dev environment. It does the following:
- Prints status of prerequisite, using
iaac/prerequisites/prerequisite.sh status - Prints status of Kubernetes cluster, using
iaac/kubernetes/k3d/k3d.sh status
./assist.sh teardown teardown the entire local dev environment. It does the following:
- Teardown Kubernetes cluster, using
iaac/kubernetes/k3d/k3d.sh teardown - Teardown .env file, using
iaac/env/env.sh teardown - Teardown k9s customization, using
iaac/devops-tools/k9s/customize.sh teardown - Teardown prerequisite, using
iaac/prerequisites/prerequisite.sh teardown.
Note: This will delete the entire cluster and all the data. Use with caution.
iaac/prerequisites/prerequisite.sh teardownis commented out by default. Uncomment it if you want to remove the prerequisite tools.