Detecting Deprecated API Versions
Identify deprecated Kubernetes API versions like extensions/v1beta1 and apps/v1beta2 in your manifests. Learn the migration paths to current stable APIs.
API Compatibility
Detailed Explanation
Deprecated Kubernetes API Versions
Kubernetes regularly deprecates and removes API versions as resources graduate from beta to stable. Using deprecated APIs causes warnings in newer clusters and will eventually break entirely when the API is removed.
Example with Deprecated API
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: legacy-app
spec:
replicas: 2
template:
metadata:
labels:
app: legacy
spec:
containers:
- name: app
image: myapp:2.0
What the Validator Flags
- Warning: Deprecated apiVersion 'extensions/v1beta1'. Use apps/v1 instead.
Common Deprecated API Migrations
| Deprecated API | Replacement | Removed In |
|---|---|---|
extensions/v1beta1 (Deployment) |
apps/v1 |
k8s 1.16 |
extensions/v1beta1 (Ingress) |
networking.k8s.io/v1 |
k8s 1.22 |
apps/v1beta1 |
apps/v1 |
k8s 1.16 |
apps/v1beta2 |
apps/v1 |
k8s 1.16 |
batch/v1beta1 (CronJob) |
batch/v1 |
k8s 1.25 |
policy/v1beta1 (PodSecurityPolicy) |
policy/v1 or Pod Security Standards |
k8s 1.25 |
How to Migrate
- Change
apiVersionto the stable version - Update any fields that changed between API versions (e.g.,
spec.selectorbecame required inapps/v1) - Test with
kubectl apply --dry-run=server - Use
kubectl convert(deprecated itself) or manually update manifests
Automated Detection
You can also use kubectl api-versions to see which APIs your cluster supports, and tools like pluto or kubent to scan for deprecated APIs across your manifests.
Use Case
Auditing existing Kubernetes manifests before upgrading the cluster to a newer version. Ensures all API versions are compatible with the target Kubernetes release.