id: kubernetes-code-env
info:
  name: Kubernetes Cluster Validation
  author: princechaddha
  severity: info
  description: |
    Checks if kubernetes CLI is set up and all necessary tools are installed on the environment.
  reference:
    - https://kubernetes.io/
  tags: cloud,devops,kubernetes,k8s,k8s-cluster-security

self-contained: true
code:
  - engine:
      - sh
      - bash
    source: |
      kubectl version

    extractors:
      - type: regex
        internal: true
        name: server_version
        group: 1
        regex:
          - 'Server Version:\s*(v[0-9]+\.[0-9]+\.[0-9]+)'

      - type: dsl
        dsl:
          - '"kubectl is successfully connected to the Kubernetes API Server Version: " + server_version'
# digest: 4a0a00473045022100965b65321d32b67468a939bbe0ff7b8dcfa0d99bb4a6dca3f69a05cd3141f3800220392abf58151c8fe9ec0f7507dfa38324b5c797a00b68b172ac29e2a7eaeebfec:922c64590222798bb761d5b6d8e72950