Project: KICS (Provisioning / Security & Compliance)
File: 94b76ea5-e074-4ca2-8a03-c5a606e30645.md

title: Object Is Using A Deprecated API Version hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: 94b76ea5-e074-4ca2-8a03-c5a606e30645 Query name: Object Is Using A Deprecated API Version Platform: Kubernetes Severity: <span style="color:#edd57e">Low</span> Category: Best Practices URL: Kubernetes APIs evolve over time and are sometimes removed with newer releases. To prevent incompatibilities when upgrading Kubernetes, deprecated APIs should be replaced with newer and more stable API versions.<br> ```yaml title="Positive test num. 1 - yaml file" hl_lines="1 76 23 58 94" apiVersion: apps/v1beta1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: name: nginx image: nginx:1.14.2 ports: containerPort: 80 apiVersion: apps/v1beta2 kind: DaemonSet metadata: name: fluentd-elasticsearch namespace: kube-system labels: k8s-app: fluentd-logging spec: selector: matchLabels: name: fluentd-elasticsearch template: spec: tolerations: key: node-role.kubernetes.io/master effect: NoSchedule containers: name: fluentd-elasticsearch image: quay.io/fluentd_elasticsearch/fluentd:v2.5.2 resources: limits: cpu: 500m memory: 200Mi requests: cpu: 100m memory: 200Mi volumeMounts: name: optmount mountPath: /opt terminationGracePeriodSeconds: 30 volumes: name: optmount hostPath: path: /opt apiVersion: extensions/v1beta1 kind: Ingress metadata: name: minimal-ingress annotations: nginx.ingress.kubernetes.io/rewrite-target: / spec: rules: http: paths: path: /testpath pathType: Prefix backend: service: name: test port: number: 80 apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: minimal-ingress1 annotations: nginx.ingress.kubernetes.io/rewrite-target: / spec: rules: http: paths: path: /testpath pathType: Prefix backend: service: name: test port: number: 80 apiVersion: batch/v1beta1 kind: CronJob metadata: name: hello spec: schedule: " *" jobTemplate: spec: template: spec: containers: name: hello image: busybox imagePullPolicy: IfNotPresent command: /bin/sh -c date; echo Hello from kics restartPolicy: OnFailure ``` ```yaml title="Negative test num. 1 - yaml file" apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: name: nginx image: nginx:1.14.2 ports: containerPort: 80 apiVersion: apps/v1 kind: DaemonSet metadata: name: fluentd-elasticsearch namespace: kube-system labels: k8s-app: fluentd-logging spec: selector: matchLabels: name: fluentd-elasticsearch template: spec: tolerations: key: node-role.kubernetes.io/master effect: NoSchedule containers: name: fluentd-elasticsearch image: quay.io/fluentd_elasticsearch/fluentd:v2.5.2 resources: limits: cpu: 500m memory: 200Mi requests: cpu: 100m memory: 200Mi volumeMounts: name: optmount mountPath: /opt terminationGracePeriodSeconds: 30 volumes: name: optmount hostPath: path: /opt ```