A miny example dashboard using SwiftkubeClient on Vapor.
ℹ️ The app tries to determine the kubeconfig automatically so a valid config should be available at the correct location.
ℹ️ The following permissions are required:
- List and Get deployments in all namespaces
- List and Get pods in all namespaces
- Create Resources in all namespaces
To try this just clone this repository and then depending on the environment:
$ git clone https://github.com/swiftkube/examples
$ cd examples/swiftkubedash
If you want to run this locally, then just build the project and start the executable:
$ swift build
$ .build/debug/Run serve --env production --hostname 0.0.0.0 --port 8080
A valid kubeconfig file should exist in your $HOME/.kube/config
, which will be picked up and used by the app.
Build the docker image and run it. You can mount a valid kubeconfig into the running container via a volume mount. For example, you can mount your local config like this:
$ docker build . -t <image>
$ docker run -v $HOME/.kube/config:/app/.kube/config -p 8080:8080 <image>
You can deploy the docker image in Kubernetes. The app will configure itself with the mounted service-account and namespace.
You can apply the manifests in the deploy
folder:
default
, then you have to change the subject's namespace in
the ClusterRoleBinding
kubectl apply -f ./deploy
This will create a deployment, configured with a service-account and a cluster-role, and a service of type ClusterIP
.
You can access it like usual, e.g. a public ingress, port-forward .. etc.