Skip to main content
Version: 11 - TBD

ConnectorTypeK8S

class connector_types.connector_type_k8s.ConnectorTypeK8S

Interact with a kubernetes cluster.

This connector type enables you to interact with a remote kubernetes cluster. See the Official Python client library for kubernetes for a description of available APIs and methods.

Input Schema

  • schema_version

    Type: string

  • authentication

    Type: anyOf

  • scheme

    The scheme to use.

    Type: anyOf

  • host

    The remote hostname or IP address.

    Type: string

  • port

    Type: anyOf

  • tls

    If to connect using TLS/SSL.

    Type: anyOf

  • mode

    Type: anyOf

Output Schema

  • result

    Data

Example

Bearer token authentication and call an API method

import yaml
import flow_api

def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
this.connect(
connector_type='K8S',
authentication={
'authentication_method': 'bearer_token',
'token': '...',
},
host='...',
mode={
'mode_name': 'call_api_method',
'api': 'CoreV1Api',
'method': 'list_namespaced_pod',
'kwargs': {
'namespace': 'default',
},
},
)

return this.success('all done')

Service account authentication, http transport and apply a document

import yaml
import flow_api

def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
nginx_deployment = system.file('nginx-deployment.yaml').get_yaml_content()
this.connect(
connector_type='K8S',
authentication={
'authentication_method': 'service_account',
'key': '...',
'scopes': ['https://www.googleapis.com/auth/cloud-platform'],
},
scheme='http',
host='...',
port={
'port_mode': 'port_number',
'port_number': 8080,
},
mode={
'mode_name': 'apply_document',
'document': nginx_deployment,
'replace': True,
},
)

return this.success('all done')