File tree Expand file tree Collapse file tree 4 files changed +59
-7
lines changed Expand file tree Collapse file tree 4 files changed +59
-7
lines changed Original file line number Diff line number Diff line change @@ -67,3 +67,4 @@ target/
6767.idea /*
6868* .iml
6969.vscode
70+ test-requirements.txt
Original file line number Diff line number Diff line change @@ -4,18 +4,49 @@ metadata:
44 name : nginx-deployment
55 labels :
66 app : nginx
7+
78spec :
8- replicas : 3
9+ replicas : 5
910 selector :
1011 matchLabels :
1112 app : nginx
13+
1214 template :
1315 metadata :
1416 labels :
1517 app : nginx
1618 spec :
1719 containers :
1820 - name : nginx
19- image : nginx:1.15.4
21+ image : nginx:1.23.3
2022 ports :
2123 - containerPort : 80
24+
25+
26+ livenessProbe :
27+ httpGet :
28+ path : /
29+ port : 80
30+ initialDelaySeconds : 5
31+ periodSeconds : 10
32+
33+
34+ readinessProbe :
35+ httpGet :
36+ path : /
37+ port : 80
38+ initialDelaySeconds : 3
39+ periodSeconds : 5
40+
41+
42+ resources :
43+ requests :
44+ cpu : " 100m"
45+ memory : " 128Mi"
46+ limits :
47+ cpu : " 250m"
48+ memory : " 256Mi"
49+
50+ env :
51+ - name : WELCOME_MESSAGE
52+ value : " Hello from Kubernetes!"
Original file line number Diff line number Diff line change 1+ from kubernetes import client , config
2+
3+ # Load kubeconfig (Ensure you have access to a cluster)
4+ config .load_kube_config ()
5+
6+ # Create API client
7+ v1 = client .CoreV1Api ()
8+
9+ # Fetch pods
10+ pods = v1 .list_pod_for_all_namespaces ()
11+
12+ # Debugging: Print the total number of pods
13+ print (f"Total pods found: { len (pods .items )} " )
14+
15+ # Iterate only if there are pods
16+ if pods .items :
17+ for pod in pods .items :
18+ print (f"Pod: { pod .metadata .name } , Namespace: { pod .metadata .namespace } " )
19+ else :
20+ print ("No pods found." )
Original file line number Diff line number Diff line change 1- coverage>=4.0.3
2- nose>=1.3.7
1+ coverage
2+ nose
33pytest
44pytest-cov
5- pluggy>=0.3.1
6- randomize>=0.13
7- sphinx>=1.4 # BSD
5+ pluggy
6+ randomize
7+ sphinx# BSD
88recommonmark
99sphinx_markdown_tables
1010pycodestyle
You can’t perform that action at this time.
0 commit comments