Skip to content

k8s list-deployments

Get k8s deployments

Description

Get the kubernetes deployments satisfying the provided args

Synopsis

k8s list-deployments
    [--site <site>]
    [--cluster <cluster>]
    [--namespace|-n <namespace>]
    [<selector>]

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 deployments
     Example: "app=kafka3,test"
     Default: _None_      Attributes: optional

Examples

Input:

! k8s list-deployments  "app=kafka3,test"
Output:
CLUSTER        NAMESPACE       NAME            REPLICAS
in-cluster     default         hello-python           2
in-cluster     default         r1-maira-agent         1
Input:
x = ! k8s list-deployments  "app=kafka3,test"
Output:
[
    {
        "cluster": "minikube",
        "namespace": "default",
        "name": "kafka3",
        "labels": {
            "app": "kafka3",
            "test": "test"
        },
        "annotations": {
            "deployment.kubernetes.io/revision": "1",
            "testing": "testing"
        },
        "deployment_status": {
            "replicas": 1,
            "updated_replicas": 1,
            "unavailable_replicas": 1,
            "deployment_conditions": [
                {
                    "type": 3,
                    "condition_status": 1,
                    "reason": "NewReplicaSetAvailable",
                    "message": "ReplicaSet \"kafka3-77bf6975d4\" has successfully progressed."
                },
                {
                    "type": 2,
                    "condition_status": 2,
                    "reason": "MinimumReplicasUnavailable",
                    "message": "Deployment does not have minimum availability."
                }
            ]
        },
        "creation_time_millis": 1629190311000
    }
]

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 "deployment"
Object ID

Please see Access Control for details.