otupy.actuators.ctxd.ctxd_actuator_kubernetes.CTXDActuator_kubernetes

class CTXDActuator_kubernetes(auth, **kwargs)

Bases: CTXDActuator

Kubernetes Actuator Manager

Extend the base CTDXActuator to retrieve services and links for a Kubernetes cluster. Currently discovery is mostly limited to pods, nodes, and containers. It should be extended in future releases with additional resources (e.g., services and file systems).

Methods

discover_links

Automatically discover links between Kubernetes components

discover_services

Discovers K8S services

get_consumer

Returns consumer data

get_services

Returns the list of current services

query

Query action

run

Entry point for running commands

Attributes

api_client

config_file

kube_context

links

It identifies the type of the service

namespace

Namespaces list

services

Name of the service

__init__(auth, **kwargs)

Initialization

The necessary parameters are: - auth: Authentication information to connect to a Kubernetes cluster Optional parameters: - namespaces: List of namespaces which resources are to be discovered. If not provided, resources from all namespaces will be discovered.

Automatically discover links between Kubernetes components

The current implementation discovers links between: - Kubernetes and nodes - Kubernetes and pods - Pods and containers - Network Policy firewall and pods

discover_services()

Discovers K8S services

Implements the required method to discover services. Currently it discover: - K8S base services (e.g., dns) - Pods in selected namespaces - Nodes - Namespaces available

get_consumer(service_name: Name) Consumer

Returns consumer data

Returns the Consumer data for the selected service name.

Parameters:

service_name – name of the service which consumer is searched.

Returns:

The consumer serving the given service, if any, None otherwise.

get_services(name: Name = None, filter: ServiceType = None) []

Returns the list of current services

Returns the list of discovered services. Filter by name and type.

Parameters:
  • name – The name of the service to retrieve (all if not set).

  • filter – The type of service (given by a void instance of ServiceType).

Returns:

A list of services that match the searching criteria.

It identifies the type of the service

namespace = []

Namespaces list

query(cmd)

Query action

This method implements the query action.

Parameters:

cmd – The Command including Target and optional Args.

Returns:

A Response including the result of the query and appropriate status code and messages.

run(cmd)

Entry point for running commands

This is the actuator entry point to receive OpenC2 commands from the otupy Consumer.

Parameters:

cmd – A Command in the format of the otupy framework.

Returns:

Response to the provided command.

services: ArrayOf = None

Name of the service