Image to expose Kubernetes Read Only Apis
375
A list of HTTP API to enquire Kubernetes Cluster about the active workload.
It's goal is to be the kubectl for read purpose.
go mod vendor
go build
./k8s-read --port=6100
GET /api/namespaces
Output:
{
"data": {
"namespaces": [
"default", "kube-system", "kube-public"
]
}
}
GET /api/deployments?namespace=default
Output:
{
data: [{
"namespace": "default",
"kind": "deployment",
"name": "nginx-app",
"image": "nginx:latest",
"replicas": 2
}]
}
GET /api/crds
{
"data": [
{
"name": "cities.world.io",
"group": "world.io",
"resource-type": "cities",
"kind": "City",
"version": "v1alpha1",
"link": "/api/crd-instances?resource-group=world.io&resource-type=cities&resource-version=v1alpha1"
}
]
}
GET /api/crd-instances?resource-group=world.io&resource-type=cities&resource-version=v1alpha1
{
"data": [
{
"namespace": "default",
"name": "s-cities",
"group": "world.io",
"version": "v1alpha1",
"kind": "City",
"link": "/api/crd-instance?resource-group=world.io&resource-type=cities&resource-version=v1alpha1&namespace=default&resource-name=s-cities"
}
]
}
GET /api/crds?namespace=default&resource-type=cities&resource-group=world.io&resource-version=v1alpha1&resource-name=s-cities
{
"data": {
"spec": {
"apps": [
{
"country": "Australia",
"name": "sydney"
},
{
"country": "USA",
"name": "san francisco"
}
]
},
"metadata": {
"annotations": {
"living-expense": "high",
"weather": "great"
},
"creationTimestamp": "2020-04-19T00:22:21Z",
"generation": 1,
"labels": {
"starts-with": "S"
},
"name": "s-cities",
"namespace": "default",
"resourceVersion": "176136",
"selfLink": "/apis/world.io/v1alpha1/namespaces/default/cities/s-cities",
"uid": "d5a9c026-81d3-11ea-b6f1-02430e0005fc"
}
}
}
docker build --no-cache -t k8s-read .
kubectl apply -f deploy/
kubectl apply -f deploy/rbac/
Content type
Image
Digest
Size
15.8 MB
Last updated
almost 6 years ago
docker pull kubesailmaker/k8s-read