Skip to content

oslabs-beta/indiK8or

Repository files navigation

Screenshot 2023-06-17 at 11 13 09 AM

Built With

JavaScript TypeScript React ReactRouter Node Express MongoDB Mongoose Passport Vite Docker Kubernetes Grafana Prometheus Helm MUI HTML CSS SCSS Jest Supertest Vitest

Introduction

Welcome to indiK8or, the ultimate Kubernetes Cluster Visualization Tool, designed to offer our users real-time cluster metrics monitoring and comprehensive vulnerability scanning functionalities.


Features

  • indiK8or provides an intuitive K8s cluster visualization, making it easy for users to access key metrics on their clusters without manually running kubectl commands.
  • indiK8or allows users to scan images of each pod in the cluster and provides a comprehensive display of any vulnerabilities detected.
  • The built-in Prometheus integration allows users to easily monitor cluster performance with no need for additional configuration.
  • Seamless Grafana integration allows access to insightful visualizations of critical cluster metrics without any setup hassles.

Getting Started

Install and start Docker. For demonstration purpose, use minikube to quickly start a local Kubernetes cluster. Start minikube by running minikube start.

NOTE: FOLLOW STEP 1-12 ONLY IF THIS IS YOUR VERY FIRST TIME USING INDIK8TOR!


  1. Fork this repo. Run npm i to install all package dependencies.

  2. Create a MongoDB database to obtain your MONGO_URI.

  3. To enable GitHub OAuth, go to your GitHub profile -> Settings -> Developer settings and register indiK8or as a new OAuth application. The Homepage url should be http://localhost:5000, and the authorization callback URL should be http://localhost:4000/auth/github/callback.

  4. Create a .env file and assign the following environment variables according to your MongoDB and OAuth set up.

        MONGO_URI=''
        SESSION_SECRET='(Randomly generated string)' 
        GitHubClientID=''
        GitHubClientSecret=''
  5. Install kubectl:

    • If you use macOS, run: brew install kubectl
    • If you use Windows, run: choco install kubernetes-cli
    • If you use Linux, run: sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

  6. Install helm:

    • If you use macOS, run: brew install helm
    • If you use Windows, run: choco install kubernetes-helm
    • If you use Linux, run:
          $ chmod 700 get_helm.sh
          $ ./get_helm.sh 
      
      NOTE: refer to this link for more details: https://kubernetes.io/docs/tasks/tools/

  7. Run below code snippet in your terminal:

     helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
     helm repo add stable https://kubernetes-charts.storage.googleapis.com/
     helm repo update
    
  8. Install Prometheus by running below command:
    helm install prometheus prometheus-community/kube-prometheus-stack

  9. Configure a yaml file for grafana by running below command, and replace 'yourFile' with the name you want for your yaml file.
    kubectl get configmap prometheus-grafana -o yaml > yourFile.yaml

  10. Once you generated this yaml file, open it and paste the code below into your yaml file inside of grafana.ini

   [security]
   allow_embedding: true
   [auth.anonymous]
   enabled: true
   [dataproxy]
   timeout: 600 
  1. Apply the yaml file by running below command, and replace 'filePath' with the path of your yaml file.
    kubectl apply -f 'filePath'

    Here is an example if your yaml file resides in your desktop folder:
    kubectl apply -f /Users/Ivy/Desktop/newMap.yaml

  2. Install grype.


NOTE: START HERE IF YOU HAVE COMPLETED THE INITIAL SETUP

  1. Restart minikube by running below commands:
    minikube stop
    minikube start

  2. Begin port forwarding Grafana with the following command:
    kubectl port-forward deployment/prometheus-grafana 3000

    Go to http://localhost:3000 and sign in to grafana with below credentials:

    default user: admin
    default password: prom-operator

    NOTE: skip step 2 if you have previously logged in.

  3. Run npm run dev and visit http://localhost:5000. Voila! You are now able to sign in and view your K8s cluster real-time data!

Usage Guidelines

Dashboard

This page of the application will provide a visual overview of your kubernetes cluster's metrics. The dashboard shows metrics on CPU usage, memory, disk, network, etc.

Pods

This page will display the health and status of each pod, providing pod details such as name, status, age, IP, and associated images. Click on the 'SCAN' button to check each image for potential vulnerabilities. Once the scanning process is complete, a pop-up window will list any existing vulnerabilities, if found.



Contributing

Contributions play a vital role in the open-source community. Any contributions are greatly appreciated!

  • Fork the project.
  • Create and work off of your feature branch.
  • Create a pull request with detailed description of your changes from your feature branch to dev branch.
  • Inform us upon PR submission. Once the changes are reviewed and approved, we will merge your code into the main repository.

Publications

Check out our Medium article here!

Meet the Team

Screenshot 2023-06-16 at 4 23 00 PM Screenshot 2023-06-16 at 4 20 50 PM Screenshot 2023-06-21 at 12 08 12 PM Screenshot 2023-06-16 at 4 23 29 PM
Tadd Lerocque Ivy Wang Yueran Li Julian Babon

License

Distributed under the MIT License.

❤️ IF OUR PRODUCT HELPED YOU, SHOW LOVE AND SUPPORT BY ⭐️ THIS REPOSITORY! ❤️