Skip to content

Instantly share code, notes, and snippets.

@vfarcic
Last active May 2, 2024 14:57
Show Gist options
  • Save vfarcic/c6f369426c5149e3d05132d5e1cda62c to your computer and use it in GitHub Desktop.
Save vfarcic/c6f369426c5149e3d05132d5e1cda62c to your computer and use it in GitHub Desktop.
# Source: https://gist.github.com/vfarcic/c6f369426c5149e3d05132d5e1cda62c
##################################################################
# Single Pane of Glass for Kubernetes Clusters with Clusterpedia #
##################################################################
# Additional Info:
# - Clusterpedia: https://clusterpedia.io
#########
# Setup #
#########
git clone https://github.com/vfarcic/clusterpedia-demo
cd clusterpedia-demo
# Watch https://youtu.be/WiFLtcBvGMU if you are not familiar with Devbox. Alternatively, you can skip Devbox and install all the tools listed in `devbox.json` yourself.
devbox shell
chmod +x setup.sh
./setup.sh
source .env
######################
# Clusterpedia Setup #
######################
kubectl get pediacluster
cat cluster-sync-resources.yaml
kubectl apply --filename cluster-sync-resources.yaml
cat pediaclusters/dot-01.yaml
cat pediaclusters/dot-02.yaml
cat pediaclusters/dot-03.yaml
kubectl apply --filename pediaclusters
kubectl get pediacluster
kubectl config get-clusters
curl -sfL \
https://raw.githubusercontent.com/clusterpedia-io/clusterpedia/v0.7.0/hack/gen-clusterconfigs.sh \
| sh -
kubectl config get-clusters
kubectl --cluster dot-01 api-resources
kubectl --cluster dot-02 api-resources
kubectl --cluster clusterpedia api-resources
###############################################
# Clusterpedia Search, Filtering, and Sorting #
###############################################
kubectl --cluster clusterpedia get deployments --all-namespaces
kubectl --cluster clusterpedia get pods --all-namespaces
kubectl --cluster clusterpedia --namespace a-team get deployments
kubectl --cluster clusterpedia --namespace a-team \
get deployments \
--selector "search.clusterpedia.io/names=silly-demo"
kubectl --cluster clusterpedia --namespace a-team \
get deployments \
--selector "internalstorage.clusterpedia.io/fuzzy-name=something"
kubectl --cluster clusterpedia --namespace a-team \
get pods --field-selector="status.phase=Running"
kubectl --cluster clusterpedia --namespace a-team \
get pods --field-selector="status.phase notin (Running)"
kubectl --cluster clusterpedia --namespace a-team \
get deployments \
--selector "search.clusterpedia.io/clusters in (dot-01,dot-02)"
kubectl --cluster clusterpedia get deployments --all-namespaces \
--selector "search.clusterpedia.io/before=2024-01-01"
kubectl --cluster clusterpedia get deployments --all-namespaces \
--selector "search.clusterpedia.io/since=2024-01-01"
kubectl --cluster clusterpedia get deployments --all-namespaces \
--selector "search.clusterpedia.io/since=2024-01-01" \
--selector "search.clusterpedia.io/orderby in (cluster, namespace)"
kubectl --cluster clusterpedia --namespace a-team get sqlclaims
kubectl --cluster dot-01 --namespace a-team \
delete sqlclaim my-db-01
###########
# Destroy #
###########
chmod +x destroy.sh
./destroy.sh
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment