Skip to content

Instantly share code, notes, and snippets.

@vfarcic
Last active October 8, 2022 02:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vfarcic/c5e49d457a607818fac9f53262cc91f3 to your computer and use it in GitHub Desktop.
Save vfarcic/c5e49d457a607818fac9f53262cc91f3 to your computer and use it in GitHub Desktop.
# Source: https://gist.github.com/c5e49d457a607818fac9f53262cc91f3
##########################################################################
# Kubernetes Notifications, Troubleshooting, And Automation With Robusta #
# https://youtu.be/2P76WVVua8w #
##########################################################################
# Additional Info:
# - Robusta: https://robusta.dev
# - Crossplane - GitOps-based Infrastructure as Code through Kubernetes API: https://youtu.be/n8KjVmuHm7A
# - How To Apply GitOps To Everything - Combining Argo CD And Crossplane: https://youtu.be/yrj4lmScKHQ
# - How To Shift Left Infrastructure Management Using Crossplane Compositions: https://youtu.be/AtbS1u2j7po
# - Argo Events - Event-Based Dependency Manager for Kubernetes: https://youtu.be/sUPkGChvD54
#########
# Setup #
#########
# Create a Kubernetes cluster with Ingress
# This demo was tested on Rancher Desktop, but it should work with any Kubernetes cluster
# Please watch https://youtu.be/bYVfCp9dRTE if you are not familiar with Rancher Desktop
git clone https://github.com/vfarcic/robusta-demo
cd robusta-demo
pip install -U robusta-cli --no-cache
helm repo add robusta \
https://robusta-charts.storage.googleapis.com
helm repo update
robusta gen-config
# Follow the instructions
helm upgrade --install \
robusta robusta/robusta \
--values generated_values.yaml \
--namespace robusta \
--create-namespace \
--wait
kubectl create namespace production
kubectl create namespace a-team
####################
# Setup Crossplane #
####################
helm repo add crossplane-stable \
https://charts.crossplane.io/stable
helm repo update
helm upgrade --install \
crossplane crossplane-stable/crossplane \
--namespace crossplane-system \
--create-namespace \
--wait
kubectl apply \
--filename https://raw.githubusercontent.com/vfarcic/devops-toolkit-crossplane/master/crossplane-config/config-gitops.yaml
######################
# Alerting On Issues #
######################
kubectl --namespace production apply \
--filename k8s
##########################
# Using Custom Playbooks #
##########################
# Open https://github.com/robusta-dev/robusta/blob/master/helm/robusta/values.yaml
cat values.yaml
helm upgrade --install \
robusta robusta/robusta \
--values generated_values.yaml \
--namespace robusta \
--create-namespace \
--wait \
--values values.yaml
# Open k8s/deployment.yaml in an editor
# and change the image tag to `5.0.5`
kubectl --namespace production apply \
--filename k8s
# Open https://docs.robusta.dev/master/tutorials/my-first-custom-action.html#writing-the-action
###############################
# Triggering On Any Resource? #
###############################
cat values-crossplane.yaml
helm upgrade --install \
robusta robusta/robusta \
--values generated_values.yaml \
--namespace robusta \
--create-namespace \
--wait \
--values values-crossplane.yaml
cat crossplane-gitops.yaml
kubectl --namespace a-team apply \
--filename crossplane-gitops.yaml
kubectl --namespace a-team apply \
--filename k8s
#####################
# Scheduled Actions #
#####################
cat values-scheduled.yaml
helm upgrade --install \
robusta robusta/robusta \
--values generated_values.yaml \
--namespace robusta \
--create-namespace \
--wait \
--values values-scheduled.yaml
###########
# Destroy #
###########
cp orig/deployment.yaml k8s/.
# Destroy or reset the cluster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment