VK Cloud logo

Working with secrets

These methods allow you to work with Kubernetes cluster secrets in the Managed Containers service, which hosts the Cloud Spark cluster. Kubernetes secrets enable secure storage and use of sensitive data that may be needed during Spark job execution.

create_secret_from_yaml

Create a secret in the specified namespace based on the provided manifest. The manifest must be in YAML format.

Required token role: Administrator. Learn more about token roles.

Method arguments

Argument

Type

Description

cluster_id

(required)

str

ID of the Cloud Spark cluster in which to create the secret. The list of Cloud Spark clusters and their IDs can be obtained using the get_clusters method

secret_yaml_path

(required)

str

Path to the YAML file with the manifest

namespace

(optional)

str

Name of the namespace in which to create the secret. This namespace must exist, otherwise the secret will not be created.

If this argument is omitted when calling the method, the default value is used: default

Return value

An object of the K8sSecret class with information about the created secret.

Field

Type

Description

name

str

Name of the secret

type

str

Type of the secret

namespace

str

Name of the namespace in which the secret is located

data

dict[str,str]

Secret data as key: value pairs. For security reasons, the data is not displayed in plain text

Method signature and usage example

list_secrets

Get the list of secret names in the specified namespace.

To get detailed information about an individual secret from the list, use the get_secret_detail method.

Required token role: Administrator or User. Learn more about token roles.

Method arguments

Argument

Type

Description

cluster_id

(optional)

str

ID of the Cloud Spark cluster for which to get the list of secrets.

The list of Cloud Spark clusters and their IDs can be obtained using the get_clusters method

namespace

(optional)

str

Name of the namespace from which to get the list of secrets.

If this argument is omitted when calling the method, the default value is used: default

Return value

An object of the K8sObjectNamesList class that contains the list of secret names.

Method signature and usage example

get_secret_detail

Get detailed information about a Kubernetes secret by its name.

Required token role: Administrator or User. Learn more about token roles.

Method arguments

Argument

Type

Description

cluster_id

(required)

str

ID of the Cloud Spark cluster for which to get information about the secret.

The list of Cloud Spark clusters and their IDs can be obtained using the get_clusters method

secret_name

(required)

str

Name of the secret to get information about.

The list of secret names can be obtained using the list_secrets method

namespace

(optional)

str

Name of the namespace in which the secret is located.

If this argument is omitted when calling the method, the default value is used: default

Return value

An object of the K8sSecret class with information about the secret.

Field

Type

Description

name

str

Name of the secret

type

str

Type of the secret

namespace

str

Name of the namespace in which the secret is located

data

dict[str,str]

Secret data as key: value pairs.

For security reasons, the data is not displayed in plain text

Method signature and usage example

delete_secret

Delete a secret by its name.

Required token role: Administrator. Learn more about token roles.

Method arguments

Argument

Type

Description

cluster_id

(required)

str

ID of the Cloud Spark cluster for which to get information about the secret.

The list of Cloud Spark clusters and their IDs can be obtained using the get_clusters method

secret_name

(required)

str

Name of the secret to delete.

The list of secret names can be obtained using the list_secrets method

namespace

(optional)

str

Name of the namespace in which the secret is located.

If this argument is omitted when calling the method, the default value is used: default

Return value

No return value.

Method signature and usage example

Was this article helpful?