Skip to content

k8s list-services

List services

Description

Lists all available k8s service in given namespace

Synopsis

k8s list-services
    [--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 services
     Example: "app=k8s,!env"
     Default: _None_      Attributes: optional

Examples

Input:

!k8s  list-services
Output:
NAME                   TYPE
hello-python-service      4
kubernetes                2
ssh                       3
Input:
!k8s  list-services
Output:
[
    {
        "cluster": "minikube",
        "namespace": "default",
        "name": "kafka1-service",
        "type": 4,
        "labels": {
            "app": "kafka1-service"
        },
        "selector": {
            "app": "kafka1"
        }
    },
    {
        "cluster": "minikube",
        "namespace": "default",
        "name": "kafka2-service",
        "type": 4,
        "labels": {
            "app": "kafka2-service"
        },
        "selector": {
            "app": "kafka2"
        }
     }
]

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

Please see Access Control for details.