Created
March 12, 2020 10:53
-
-
Save pathcl/ae528942c696d980068a4d3f52e79008 to your computer and use it in GitHub Desktop.
kubernetes python api example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
from kubernetes import client, config | |
from kubernetes.utils import create_from_yaml | |
k8s_config = config.load_kube_config( | |
config_file="/yourkubeconfig/kubeconfig") | |
k8s_client = client.api_client.ApiClient(configuration=k8s_config) | |
# taken from here https://raw.githubusercontent.com/pathcl/hellok8s/master/helloworld.yaml | |
create_from_yaml(yaml_file='helloworld.yaml', | |
k8s_client=k8s_client, verbose=True, namespace="default") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment