☸️ Kubernetes

Updated at 2018-12-31 02:41

Kubernetes API is provided by kube-apiserver master component. You don't have to worry about any of this if you are using a managed Kubernetes though.

You create, modify and delete Kubernetes objects through Kubernetes API. kubectl command-line client is just one interface for this API. You could do the same with a Python based client. Or even use the REST API without a wrapper if you are hardcore.

API version is defined in the URL. Alpha level APIs shouldn't be used in production code as they can change drastically. Beta level APIs should be ok for non-business critical use-cases as some details might change.


API groups make it easier to extend the Kubernetes API.

# legacy group
/api/v1                      => apiVersion: v1

# named groups
/apis/batch/v1               => apiVersion: batch/v1

You enable/disable API groups with --runtime-config. Remember to restart the kube-apiserver for these to take effect.

# disable batch/v1

# enable batch/v2alpha1

DaemonSets, Deployments, HorizontalPodAutoscalers, Ingress, Jobs and ReplicaSets are enabled by default. But to actually use HPA also needs Metric Server to be installed, if you don't have that already. Your managed Kubernetes cluster may have other APIs enabled as well.