Skip to main content

API

k get api-versions
k get api-resources

k explain job # or resource to see yaml manifest structure & version

Enable and Disable API groups

kube-apiserver --runtime-config=flowcontrol.apiserver.k8s.io/v1alpha1=true ...

Enable all stable APIs but disable all alpha

--runtime-config=api/all=true
--runtime-config=api/alpha=false

List

kubectl api-versions
kubectl get --raw / | jq

Storage Version

Resource is stored in etcd, it is serialized using a specific API version. This version is called the storage version. Even if a user interacts via v1beta1, the object might be stored as v1.

  • Kubernetes prefers GA (generally available) versions for storage.
  • Alpha versions are never used as storage versions.

Storage Version For CRDs (CustomResourceDefinitions)

You can control this directly via the spec.preserveUnknownFields and spec.versions[*].storage flags. 📌 Only one version should have storage: true.

spec:
group: mygroup.example.com
names:
kind: MyKind
plural: mykinds
scope: Namespaced
versions:
- name: v1alpha1
served: true
storage: false
- name: v1
served: true
storage: true # 👈 this becomes the storage version

Kubectl Convert

The kubectl convert command allows you to convert manifests between different API versions.

kubectl convert -f my-resource.yaml --output-version apps/v1