Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5c2cbff commit 3aa1143Copy full SHA for 3aa1143
examples/apply_from_dict.py
@@ -0,0 +1,10 @@
1
+from kubernetes import client, config, utils
2
+def main():
3
+ config.load_kube_config()
4
+ k8s_client = client.ApiClient()
5
+ # example nginx deployment
6
+ example_dict = {'apiVersion': 'apps/v1', 'kind': 'Deployment', 'metadata': {'name': 'k8s-py-client-nginx'}, 'spec': {'selector': {'matchLabels': {'app': 'nginx'}}, 'replicas': 1, 'template': {'metadata': {'labels': {'app': 'nginx'}}, 'spec': {'containers': [{'name': 'nginx', 'image': 'nginx:1.14.2', 'ports': [{'containerPort': 80}]}]}}}}
7
+ utils.create_from_dict(k8s_client, example_dict)
8
+
9
+if __name__ == '__main__':
10
+ main()
0 commit comments