GithubHelp home page GithubHelp logo

kitarp29 / kube-ez Goto Github PK

View Code? Open in Web Editor NEW
70.0 4.0 12.0 18.16 MB

This is a simple k8s-api project. It is built on Golang and utilises the client-go library to interact with Kubernetes Cluster. It is a plug and play solution and can be used to create a k8s-api server.

License: MIT License

Go 99.41% Dockerfile 0.59%
docker golang helm kuberentes cli devops devops-tools kubernetes-cluster rest-api

kube-ez's Introduction

Kube-ez

GitHub contributors GitHub issues Docker Docker Follow

Introduction ๐Ÿ‘‹๐Ÿป

It is built on Golang and utilizes the client-go library to interact with Kubernetes Cluster. It is a plug-and-play solution and can be used to create a kube-ez server. In three easy steps, you will have a simple API to interact with your cluster. The aim is to build a simple API server that can be used to interact with any Kubernetes cluster.

In my industrial experience, I have realized that Kubernetes is a very powerful tool but, only used by a handful of developers in the organization. The problem is not grasping the concept of the cluster. My last Product Manager was much more versed in AWS than I am. I feel the reason is that there is no easier way to interact with it. This project will provide a bunch of API endpoints to perform various functions on the cluster. For now, I will have the Postman collections and API docs to achieve it, plan is to build a Dashboard on the API later.

Docker Image: kitarp29/k8s-api

Use the Docker image with tag 2.0 or above to run the kube-ez server.


Getting started โ–ถ๏ธ

To start using the project you need a Kubernetes Cluster and should have the right access to apply changes to the cluster. There are two ways to run this project.

  1. Outside the Cluster
  2. Inside the Cluster

Steps to run the project are mentioned in the INSTALL.md


Project Features ๐Ÿคฏ

  • Get details about any resource in the cluster.
  • It detects if you are trying to run the project inside or outside of a cluster.
  • Create new resources in the cluster.
  • Delete resources in the cluster.
  • Run CLI commands using the API.
  • Manage Helm Charts.
  • You can add, install, delete and update HELM charts.
  • Get live events from the cluster.
  • It is a REST API to interact with the cluster.
  • It has a health check endpoint as well.
  • More coming soon... ๐Ÿšง

API Docs ๐Ÿ“–

There are multiple endpoints in the API. You can find all the endpoints in the API Docs

Moreover you can find the Postman Collections Here ๐Ÿ“ฎ


Contributors Guide ๐Ÿฅฐ

Thanks for considering contributing to the project. If you have any questions, please feel free to contact me at Twitter. The Contributors Guide is available Here ๐Ÿ“–


License ๐Ÿป

This project is licensed under the MIT license. Feel free to use it and if you want to contribute, please feel free to fork the project and make a pull request. Thanks!


FAQ ๐Ÿค”

  • Is this a Unique Product?

    No, this is not a unique product. There are similar implementations made by other developers.

  • Purpose of this project?

    It's a pet project to learn Kubernetes and Golang. I wanted to build this to better understand these two technologies. I also explored Docker

Thanks for your interest in my API :)


kube-ez's People

Contributors

dependabot[bot] avatar kitarp29 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

kube-ez's Issues

Make a better YAML

Make a better YAML

The idea started with this issue: - #52
Why not use all my learnings as a DevOps Engineer to build a better YAML to install Kube-ez.
I will keep this open, to keep building on it.
The File I am referring to is here: - one-to-rule-them-all.yaml
image

Establishing a Cache in the project

This would be a fun addition to the project. Say I create a cache for each API result that I do. And if the Kubernetes API takes some time (say more than 2s) it loads the results based on cache. Yes it would be coming with a warning, that the results are not real time.

I like it as of now, not sure when will I get time for this. But would be a fun thing to integrate Redis or some cache in Go.

Browser based GET "/favicon.ico" requests

So this project can be run on curl or on Browser.
Web Browsers by their nature have this irritating nature to bug the API with a GET Request to "/favicon.ico"
I am no wiz in Frontend, but what I learned is that it does this to get an icon for the tab.
I don't have any problem with it, only that this is making my Logs look ugly !
Without any reason I am seeing 500 error codes in my logs for a URI I never intended to make.

I want to disable this. No matter the cost.
Anyone is welcome to do it! Or else:
image

Better Logging in this project

I want to implement more ellaboarte logs in this project.
I will be using Logrus for this purpose.
I am bored this weekend so why not kickoff this old project with an easy task

Check for CVEs

Right now the CI is set up such that every successful build of Docker Image will be pushed to ghcr.
But this is very risky, as I am not scanning for CVEs. Neither I have Image scanning open on my Docker Hub as I am broke.
So we need to find some CLI-based Docker Image Scanning Jobs in the CI.
Refer to This: Here
image

Make a Deployment

How the HELL did I miss it!??

I can make a Deployment for the YAML file. This deployment will handle the Pod, and will restart the pod in case it dies of natural causes XD

I will update the YAML File to include it.

Folks! this is PROOF, that nothing good happens late night.

jim-carrey-stupid-stupid

Make abetter Health page

Make a useful health page. RN the page is useless. I wanna add more infor in this.
And have a Global var like RESULT = PASS or FAIL
If this is adopted anyday in CNCF ๐Ÿ˜‚๐Ÿคฃ
It will help services like Datadog restart ghe pod in case of failure.

Be aware you use this enpoint in the CI
proceed with Caution!

Rewrite Project using SharedInformers

Right now the project is using the client-go library and the rest k8sio APIs to query the API server each time the request comes in. This idea is surely not scalable if the traffic increases. I want to rewrite the project and use ShardInformers in place of multiple calls to API Sever of the master node.
If you wanna ask, why didn't I make the project using shared informers in the first place, I just wanna say:
Screenshot 2022-10-31 at 2 54 52 AM

checking vulnerabilities in code

Use this to find the vulnerabilities of my code. We might have to find an automated process to integrate it into github actions so that each push is tested for vulnerability

Lesser CI Jobs

This started here:

I want to run the CI runner only when there is a change in the Go codebase.
WTH is my CI running when I did changes to simple Markdown?

I know it doesn't cost me anything to run the CI.
But it is actually a waste of resources of GitHub.
Github might start getting charged in future
It is out of my training as a DevOps engineer to waste resources.
.
.
.
Mainly I can't sleep, so let's do something๐Ÿ˜…

image

Adding recover() in codebase

Just learnt about a great in-built function in Go that handles panic situation. It will be an easy issue. I will post more details once I get back home from office ๐Ÿ‘

Make a Helm chart

We could actually make a Helm chart to ease the process of installing this project on any k8s cluster

Making a Better Docker Image

I know I have already optimized the size of the Docker Image used in this project.
But recently I came across a great resource to make Industry ready images.

So, why not include them!??

Here is the Twitter Thread I am referring to : Here

Build a better CI

TBH looking right now at the CI of the project all I can say is:
giphy

YES! it hurts to look at such a shitty CI.
What I am looking at?

  • A CI that builds binary for each push.
  • Uses that binary on the docker image.
  • Run that docker image in a Kubernetes cluster.
  • Run all the Unit tests against the preexisting functions.

Will I be able to do it??

MAYBE

Let's give it a try!

Adding Better API Documentation

I know this repository has Documentation for the API already : Here

But I recently learned there are industry standard way to do this.
I have added the postman collection for reference : Here

For this task I was looking forward to use something such as Swagger

I will provide the detailed steps, real soon!


Making a CLI version

Can we build a CLI version of this project using this??
I know I know, CLI version of a K8s-api is just kubectl ("as if I didn't knew")

But still, it would be cool to build a CLI with this
CLI-Maker

Setting up Email triggers

Since we are making a project that has to manipulate one's cluster, we should have email triggers set up. Emai, triggers can act as AWS SNS. I am even not sure if it can be implemented in what manner, but surely can be handy feature.
You might want to use this package Email

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.