Skip to content

Instantly share code, notes, and snippets.

@vfarcic
Created September 12, 2021 21:33
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vfarcic/d5b87f257a82bf66ca15607308999054 to your computer and use it in GitHub Desktop.
Save vfarcic/d5b87f257a82bf66ca15607308999054 to your computer and use it in GitHub Desktop.
# Referenced videos:
# - How to run local multi-node Kubernetes clusters using kind: https://youtu.be/C0v5gJSWuSo
#########
# Setup #
#########
# A kubectl plugin providing diagnostic tools for Kubernetes applications
git clone https://github.com/vfarcic/troubleshoot-demo.git
cd troubleshoot-demo
# Please watch https://youtu.be/C0v5gJSWuSo if you are not familiar with kind
# Feel free to use any other Kubernetes platform
kind create cluster --config kind.yaml
# If not using kind, change the command to the one valid for your Kubernetes distribution
kubectl apply \
--filename https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/kind/deploy.yaml
kubectl --namespace ingress-nginx \
rollout status \
deployment ingress-nginx-controller
kubectl create namespace production
kubectl --namespace production \
apply --filename k8s
# Install Krew (https://krew.sigs.k8s.io/docs/user-guide/setup/install/) if you do not have it already
kubectl krew install preflight
kubectl krew install support-bundle
#####################
# Preflights checks #
#####################
kubectl preflight preflight.yaml
cat preflight.yaml
kubectl preflight preflight.yaml \
--namespace production
# Open https://troubleshoot.sh/docs/analyze/
#####################
# Fixing the issues #
#####################
cat kind-new.yaml
kind delete cluster
kind create cluster \
--config kind-new.yaml
kubectl apply \
--filename https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/kind/deploy.yaml
kubectl --namespace ingress-nginx \
rollout status \
deployment ingress-nginx-controller
kubectl create namespace production
kubectl --namespace production \
apply --filename k8s
kubectl preflight preflight.yaml \
--namespace production
#############################
# Creating a support bundle #
#############################
cat support-bundle.yaml
# Open https://troubleshoot.sh/docs/collect/all/
kubectl support-bundle \
support-bundle.yaml \
--namespace production
# Replace `[...]` with the name of the bundle (from the output of the previous command) without including the `.tar.gz` extension (e.g., support-bundle-2021-09-02T00_23_23)
export BUNDLE=[...]
tar -xzvf $BUNDLE.tar.gz
ls -1 $BUNDLE/
cat $BUNDLE/cluster-info/cluster_version.json
ls -1 $BUNDLE/cluster-resources
cat $BUNDLE/cluster-resources/pods/production.json
cat $BUNDLE/cluster-resources/ingress/production.json
cat $BUNDLE/*.log
# Open https://troubleshoot.sh/docs/redact/
###########
# Destroy #
###########
kind delete cluster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment