Skip to content

Instantly share code, notes, and snippets.

View mossad-zika's full-sized avatar
🦍
Monkey business

Evgenii Pavlov mossad-zika

🦍
Monkey business
View GitHub Profile
@mossad-zika
mossad-zika / versions.py
Created January 21, 2024 16:39
Return a warning if version of kubectl is not compatible with the version of k8s server.
import subprocess
import yaml
def check_kubectl_compatibility_yaml():
"""Checks compatibility between kubectl client and server versions using YAML output."""
version_output = subprocess.check_output(["kubectl", "version", "--output=yaml"]).decode("utf-8")
version_data = yaml.safe_load(version_output)