Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Security in Yandex Cloud
  • Key security principles
  • Division of responsibility
  • Compliance
  • Security measures on the Yandex Cloud side
  • Security tools available to cloud service users
    • All tutorials
      • Encrypting secrets in Managed Service for Kubernetes
      • Signing and verifying Container Registry Docker images in Managed Service for Kubernetes
      • Syncing with Managed Service for Kubernetes secrets
      • Getting Yandex Lockbox secret value on the Kubernetes side
      • Creating an L7 load balancer with a Smart Web Security security profile through an Application Load Balancer Ingress controller
      • Migrating services from a NLB load balancer with target resources from a Managed Service for Kubernetes cluster to an L7 ALB load balancer
      • Transferring Managed Service for Kubernetes cluster logs to Cloud Logging
  • User support policy during vulnerability scanning
  • Security bulletins
  • Public IP address ranges

In this article:

  • Required paid resources
  • See also
  1. Tutorials
  2. Kubernetes security
  3. Encrypting secrets in Managed Service for Kubernetes

Encrypting secrets in Yandex Managed Service for Kubernetes

Written by
Yandex Cloud
Updated at May 13, 2025
  • Required paid resources
  • See also

Use Yandex Key Management Service keys to encrypt secrets, i.e., confidential information, such as passwords, OAuth tokens, and SSH keys, in Yandex Managed Service for Kubernetes. To do this, specify a Key Management Service key when creating a Managed Service for Kubernetes cluster. This key will be used for encryption and decryption.

Make sure you specify the encryption key when creating a Managed Service for Kubernetes cluster, as you cannot add it when updating the cluster.

Required paid resourcesRequired paid resources

The cost of support for the described solution includes a Key Management Service fee: number of active key versions (with Active or Scheduled For Destruction for status) and completed cryptographic operations (see Key Management Service pricing).

Management console
CLI
Terraform
API

Specify a key when creating a Managed Service for Kubernetes cluster:

  1. In the management console, select the folder where you want to create a Managed Service for Kubernetes cluster.
  2. In the list of services, select Managed Service for Kubernetes.
  3. Click Create cluster.
  4. In the Encryption key field, enter the required key or create a new one.
  5. Enter all the other parameters to create your cluster.
  6. Click Create.

If you do not have the Yandex Cloud (CLI) command line interface yet, install and initialize it.

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

You can specify a key when creating a Managed Service for Kubernetes cluster in two ways:

  • Using the key ID:

    yc managed-kubernetes cluster create \
      ...
      --kms-key-id <key_ID> \
      ...
    
  • Using the key name:

    yc managed-kubernetes cluster create \
      ...
      --kms-key-name <key_name> \
      ...
    

With Terraform, you can quickly create a cloud infrastructure in Yandex Cloud and manage it using configuration files. These files store the infrastructure description written in HashiCorp Configuration Language (HCL). If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.

Terraform is distributed under the Business Source License. The Yandex Cloud provider for Terraform is distributed under the MPL-2.0 license.

For more information about the provider resources, see the documentation on the Terraform website or mirror website.

If you do not have Terraform yet, install it and configure its Yandex Cloud provider.

Specify a key when creating a Managed Service for Kubernetes cluster:

  1. Add a section named kms_provider to the Managed Service for Kubernetes cluster description:

    resource "yandex_kubernetes_cluster" "<cluster_name>" {
      ...
      kms_provider {
        key_id = "<key_ID>"
      }
    }
    
  2. Make sure the configuration files are correct.

    1. In the command line, go to the folder where you created the configuration file.

    2. Run a check using this command:

      terraform plan
      

    If the configuration is described correctly, the terminal will display a list of created resources and their parameters. If the configuration contains any errors, Terraform will point them out. This is a test step; no resources will be created.

  3. Create a Managed Service for Kubernetes cluster.

    1. If the configuration does not contain any errors, run this command:

      terraform apply
      
    2. Confirm that you want to create the resources.

    After this, all required resources will be created in the specified folder and the IP addresses of the VMs will be displayed in the terminal. You can check the new resources and their configuration using the management console.

Specify the encryption key when creating a Managed Service for Kubernetes cluster. To do this, use the create REST API method for the Cluster resource or the ClusterService/Create gRPC API call.

Provide the key ID in the relevant kmsProvider field parameter.

Managed Service for Kubernetes works with Key Management Service using the Key Management Service provider mechanism. Managed Service for Kubernetes supports the Key Management Service plugin which is used to encrypt and decrypt data encryption keys (DEK) in Key Management Service. Secrets are encrypted using standard Kubernetes tools.

See alsoSee also

  • Getting started with Managed Service for Kubernetes
  • Envelope encryption
  • Creating secrets in Kubernetes

Was the article helpful?

Previous
SmartCaptcha in iOS apps
Next
Signing and verifying Container Registry Docker images in Managed Service for Kubernetes
Yandex project
© 2025 Yandex.Cloud LLC