- A RESTful API to interact with Kubernetes resources
- Easy to customize and integrate with UI/Chatbot/Automation
It consists of 3 main components:
- Backend - Rest API (Go)
- Frontend (Vue.js) (BEING DEVELOPED)
- Persistent Layer to store configurations
- Update swagger docs: https://github.com/swaggo/swag
swag init
Contributions are welcome via PRs with Issues!
Use Go Module
export GO111MODULE=on
Start the API locally
# Clone the repository
git clone https://github.com/supernova106/kubestorm.git
cd kubestorm/
go run main.go
Or using the pre-built binary
./kubestorm
- create the following
kubestorm.yaml
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: kubestorm-role
rules:
- apiGroups: ["", "extensions", "apps", "batch", "events", "resourcequotas"]
resources: ["*"]
verbs: ["list", "watch", "get"]
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: kubestorm-user
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: kubestorm-user
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kubestorm-role
subjects:
- kind: ServiceAccount
name: kubestorm-user
namespace: kube-system
kubectl apply -f kubestorm.yaml
Get server URL
export CURRENT_CONTEXT=$(kubectl config current-context) && export CURRENT_CLUSTER=$(kubectl config view -o go-template="{{\$curr_context := \"$CURRENT_CONTEXT\" }}{{range .contexts}}{{if eq .name \$curr_context}}{{.context.cluster}}{{end}}{{end}}") && echo $(kubectl config view -o go-template="{{\$cluster_context := \"$CURRENT_CLUSTER\"}}{{range .clusters}}{{if eq .name \$cluster_context}}{{.cluster.server}}{{end}}{{end}}")
Get serverCADataString
echo $(kubectl get secret -n kube-system -o go-template='{{index .data "ca.crt" }}' $(kubectl get sa kubestorm-user -n kube-system -o go-template="{{range .secrets}}{{.name}}{{end}}"))
Get token
echo $(kubectl get secret -n kube-system -o go-template='{{index .data "token" }}' $(kubectl get sa kubestorm-user -n kube-system -o go-template="{{range .secrets}}{{.name}}{{end}}")) | base64 --decode
Execute the following script to add cluster
export CLUSTER_NAME="foo"
# replace with actual URL of kubestorm
./scripts/add_cluster.sh "${CLUSTER_NAME}" http://localhost:8080
# get auth
curl --location --request GET "http://localhost:8080/api/v1/auth/${CLUSTER_NAME}"
# delete
curl --location --request DELETE "http://localhost:8080/api/v1/auth/${CLUSTER_NAME}"
curl --location --request GET "http://localhost:8080/api/v1/resources?cluster=${CLUSTER_NAME}&type=nodes"
- The release process is automated via git tagging.
- Check out the
.github/workflows/goreleaser.yml
- Add more unit testings
- Develop Simple Dashboard for Kubernetes
- Support S3 to store configurations
- Slack Chatbot integration
- Binh Nguyen