Clone the Spyglass repo from GitHub to your local machine.
git clone https://github.com/oslabs-beta/spyglass.git
MONGO_URI=
VITE_LOCALCLUSTERIP=
VITE_LOCALCLUSTERNAME=
VITE_CLOUDCLUSTERIP=
VITE_CLOUDCLUSTERNAME=
Here is an example ENV file:
MONGO_URI= "mongodb+srv://dummyAcc:HVcsVJuNv2fTCJJl@spyglassdev.jmhr4fn.mongodb.net/?retryWrites=true&w=majority"
VITE_LOCALCLUSTERIP=localhost:8000
VITE_LOCALCLUSTERNAME=IMOt5Yf4z
VITE_CLOUDCLUSTERIP=aefc1187804224b2389464585a69932b-1354669704.us-west-2.elb.amazonaws.com
VITE_CLOUDCLUSTERNAME=DtgSFtBVk
To get started, you will need to have a Kubernetes cluster. You can create a single-node Kubernetes cluster on your local machine using Minikube. Install Minikube using documentation.
Here are instructions if you have a MacOS:
- Install Docker
brew install docker
- Install Minikube
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-darwin-arm64
sudo install minikube-darwin-arm64 /usr/local/bin/minikube
- Start your cluster
minikube start --vm-driver=docker
Helm is a package manager for Kubernetes that manages and packages all the necessary resources for your Kubernetes cluster in a single unit called a chart. See documentation for more information.
Kube-Prometheus-Stack is a Helm chart that includes a set of applications to monitor Kubernetes clusters using the Prometheus monitoring system. See documentation for more information.
Here are instructions if you have a MacOS:
- Install Helm
brew install helm
- Add prometheus-community repo to Helm and update
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
- Create a new namespace in your cluster named
monitoring
kubectl create namespace monitoring
- Install Kube-Prometheus-Stack
helm install kubepromstack prometheus-community/kube-prometheus-stack --namespace=monitoring
- Retrieve information about the pods running in the
monitoringnamespace of your Kubernetes cluster
kubectl get pods --namespace monitoring
Grafana is an application part of Kube-Prometheus-Stack and provides visualizations for metrics monitoring a Kubernetes cluster. See documentation for more information.
- Edit Grafana's configuration map in order to render visuals correctly in Spyglass.
kubectl edit configmap kubepromstack-grafana --namespace monitoring
Make this change in Grafana's configuration map.
[security]
allow_embedding = true
- Access Grafana by port-forwarding to http://localhost:8000 or click "Local Cluster Metrics" in Spyglass.
kubectl port-forward -n monitoring svc/kubepromstack-grafana 8000:80
Kubecost analyzes CPU, PV, and RAM resource usage on Kubernetes clusters. Using Kubecost, Spyglass helps provide monthly estimates to help you optimize your costs! See documentation for more information.
- Install Kubecost and create a namespace named
kubecost
helm install kubecost cost-analyzer \
--repo https://kubecost.github.io/cost-analyzer/ \
--namespace kubecost --create-namespace \
--set kubecostToken="Y2luZHljaGF1MTFAZ21haWwuY29txm343yadf98"
- Retrieve information about the pods running in the
kubecostnamespace of your Kubernetes cluster
kubectl get pods --namespace kubecost
- Access Kubecost by port-forwarding to http://localhost:9090 or click "Cost Analysis" in Spyglass.
kubectl port-forward --namespace kubecost deployment/kubecost-cost-analyzer 9090
Kubeview provides a graphical representation of a Kubernetes cluster and its resources. See documentation for more information.
- Add Kubeview repo to Helm
helm repo add kubeview https://benc-uk.github.io/kubeview/charts
- Install Kubeview (Please replace with current version)
helm install my-kubeview kubeview/kubeview --version 0.1.31 --namespace=monitoring
- Access Kubeview by port-forwarding to http://localhost:9000 or click "Cluster Visualizer" in Spyglass.
kubectl port-forward svc/my-kubeview -n monitoring 9000:80
Prometheus is another application part of Kube-Prometheus-Stack and scrapes metrics on Kubernetes clusters. See documentation for more information.
- Access Prometheus by port-forwarding to http://localhost:7000
kubectl port-forward -n monitoring svc/kubepromstack-prometheus 7000:9090