We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d1adc8a commit b2f9755Copy full SHA for b2f9755
kubernetes/test/test_pod_logs.py
@@ -0,0 +1,33 @@
1
+from kubernetes import client, config, watch
2
+
3
+pod_name = "demo-bug"
4
5
6
+config.load_kube_config()
7
8
9
+api = client.CoreV1Api()
10
+namespace = config.list_kube_config_contexts()[1]["context"]["namespace"]
11
12
+pod_manifest = {
13
+ "apiVersion": "v1",
14
+ "kind": "Pod",
15
+ "metadata": {
16
+ "name": pod_name,
17
+ },
18
+ "spec": {
19
+ "containers": [{"image": "hello-world", "name": pod_name}],
20
21
+}
22
+api.create_namespaced_pod(body=pod_manifest, namespace=namespace)
23
24
+input("\n\nSubmit when running\n\n")
25
26
+w = watch.Watch()
27
+for e in w.stream(
28
+ api.read_namespaced_pod_log,
29
+ name=pod_name,
30
+ namespace=namespace,
31
+ follow=True,
32
+):
33
+ print(e)
0 commit comments