k8s list-pods
Get k8s pods
Description
Get all the kubernetes pods
Synopsis
Arguments
site
- (string)
Site where this command will be executed
Example: --site "site-1"
Default: input.site
Attributes: optional
cluster
- (string)
Cluster where this command will be executed
Example: --cluster "in-cluster"
Default: in-cluster
Attributes: optional
namespace
- (string)
Kubernetes namespace
Example: --namespace "namespace-1"
Default: default
Attributes: optional
selector
- (string)
Selector to select the pods to be listed
Example: "app=pod1,!label1"
Default: _None_
Attributes: optional
Examples
Input:
Output:NAME STATUS RESTARTS CONTAINERS AGE
hello-python-75b7fb8899-4hhsz Running hello-python 59d5h
hello-python-75b7fb8899-lpgdv Running hello-python 59d5h
r1-maira-agent-69c87875b9-p6bnw Running maira-gateway 25h7m
[
{
"cluster": "minikube",
"namespace": "default",
"name": "kafka1-7cb95d9db6-xdkx4",
"containers": [
{
"name": "kafka1",
"image": "wurstmeister/kafka:latest",
"state": 4,
"restart_count": 66,
"StateDetails": {
"StateWaiting": {
"reason": "CrashLoopBackOff",
"message": "back-off 5m0s restarting failed container=kafka1 pod=kafka1-7cb95d9db6-xdkx4_default(01cf06a3-31cf-4044-ad75-cc36f074b741)"
}
}
}
],
"node_ip": "192.168.49.2",
"pod_ip": "172.17.0.3",
"state": 3,
"labels": {
"app": "kafka1",
"pod-template-hash": "7cb95d9db6"
},
"pod_conditions": [
{
"type": 2,
"status": 1
},
{
"type": 3,
"status": 2
},
{
"type": 1,
"status": 2
},
{
"type": 4,
"status": 1
}
],
"status": "CrashLoopBackOff",
"start_time_millis": 1629190297000
}
]
Access Control
To use this command, you need access to the following:
Field | Value |
---|---|
Action | "read" |
Service Type | "k8s" |
Service Instance | cluster |
Namespace | namespace |
Object Type | "pod" |
Object ID |
Please see Access Control for details.