Yandex.Cloud
  • Services
  • Why Yandex.Cloud
  • Solutions
  • Pricing
  • Documentation
  • Contact us
Get started
Yandex Managed Service for Kubernetes
  • Getting started
  • Step-by-step instructions
    • All instructions
    • Connecting to a node over SSH
    • Creating a configuration file
    • Configuring a Kubernetes cluster network
      • Granting access to an app running in a Kubernetes cluster
      • Using Kubernetes cluster network policies
    • Encrypting secrets
    • Using persistent volumes
      • Dynamically preparing volumes
      • Statically preparing volumes
      • Managing storage classes
      • Expanding a volume
      • Mounting a volume in Block mode
    • Managing a Kubernetes cluster
      • Adding Kubernetes cluster credentials to the kubectl configuration file
      • Getting information about a Kubernetes cluster
      • Creating a Kubernetes cluster
      • Editing a Kubernetes cluster
      • Deleting a Kubernetes cluster
    • Managing a node group
      • Getting information about a node group
      • Creating a node group
      • Editing a node group
      • Deleting a node group
  • Solutions
    • All solutions
    • Integration with Container Registry
    • Running workloads with GPUs
    • Installing the NGINX Ingress Controller with Let's Encrypt®
    • Making backups to Object Storage
  • Concepts
    • Relationship between service resources
    • Release channels and updates
    • Using Kubernetes API objects
      • Volume
      • Service
    • Node group
      • Autoscaling node groups
      • Evicting pods from a node
      • Dynamic resource allocation for a node
      • Node groups with GPUs
    • Kubernetes cluster network policies
    • Quotas and limits
  • Access management
  • Pricing policy
  • API reference
    • Authentication in the API
    • gRPC
      • Overview
      • ClusterService
      • NodeGroupService
      • VersionService
      • OperationService
    • REST
      • Overview
      • Cluster
        • Overview
        • create
        • delete
        • get
        • list
        • listNodeGroups
        • listNodes
        • listOperations
        • start
        • stop
        • update
      • NodeGroup
        • Overview
        • create
        • delete
        • get
        • list
        • listNodes
        • listOperations
        • update
      • Version
        • Overview
        • list
  • Questions and answers
  1. Getting started

Getting started

  • Before you start
  • Create a cluster Kubernetes
  • Add credentials to the kubectl configuration file
  • Create a node group
  • What's next

Create a cluster Kubernetes and node group and manage them using kubectl, the Kubernetes command-line interface.

Before you start

To start working with Managed Service for Kubernetes:

  1. Go to the management console. Then log in to Yandex.Cloud or sign up if you don't have an account yet.

  2. On the billing page, make sure that a billing account is linked and that its status is ACTIVE or TRIAL_ACTIVE. If you don't have a billing account, create one.

  3. If you don't have a folder, create one.

  4. Install the Kubernetes CLI (kubectl).

  5. Make sure you have enough resources available in the cloud.

  6. If you don't have a network, create one.

  7. If you don't have any subnets, create them in the availability zones where your Kubernetes cluster and node group will be created.

  8. Create service accounts:

    • A service account for resources with the editor role for the folder where the Kubernetes cluster will be created. The resources that the Kubernetes cluster needs will be created on behalf of this account.
    • A service account for nodes with the container-registry.images.puller role for the folder with the Docker image registry. Nodes will download the Docker images they require from the registry on behalf of this account.

    You can use the same service account for both operations.

Create a cluster Kubernetes

  1. In management console, select the folder where you want to create your Kubernetes cluster.
  2. In the list of services, select Managed Service for Kubernetes.
  3. Click Create cluster.
  4. Enter a name and description for the Kubernetes cluster.
  5. Specify a service account for the resources. This is used to create the resources.
  6. Specify a service account for nodes. The nodes use this service account to access the Docker image registry.
  7. Specify a release channel.
  8. Under Master configuration:
    • In the Kubernetes version field, select the Kubernetes version to be installed on the master.

    • In the Public IP field, choose a method for assigning an IP address:

      • Auto: Assign a random IP address from the Yandex.Cloud IP pool.
      • No address: Don't assign a public IP address.
    • In the Master type field, select the type of master:

      • Zonal: A master created in a subnet in one availability zone.
      • Regional: A master created and distributed in three subnets in each availability zone.
    • Select the availability zone where you want to create the master node address.

      This step is only available for the zonal master.

    • In the Network format field, choose how networks are displayed:

      • List: Available networks are displayed as a list. If you don't have a cloud network, click Create network:
        • In the window that opens, enter a name for the network. Specify that subnets should be created. Click Create network. By default, networks are created with subnets in each availability zone.
      • ID: Enter the unique ID of the required networks.
    • In the Cloud network field, select the network to create the master in.

    • In the Subnet field, select the subnet to create the master in.

      For the regional master, specify three subnets in each availability zone.

  9. Under Maintenance window settings:
    • In the Maintenance frequency / Disable field, configure the maintenance window:
      • Disabled: Automatic updates are disabled.
      • Anytime: Maintenance is allowed at any time.
      • Daily: Maintenance is performed in the time interval specified in the Time (UTC) and duration field.
      • On selected days: Maintenance is performed in the time interval specified in the Weekly schedule field.
  10. Under Cluster network settings:
    • Specify the cluster CIDR, which is a range of IP addresses for allocating pod addresses.
    • Specify the service CIDR, which is a range of IP addresses for allocating service addresses.
  11. Click Create cluster.

Add credentials to the kubectl configuration file

CLI

If you don't have the Yandex.Cloud command line interface yet, install and initialize it.

The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id parameter.

To add Kubernetes cluster credentials to the kubectl configuration file:

  1. Run the command:

    $ yc managed-kubernetes cluster get-credentials test-k8s-cluster --external
    
    • By default, credentials are added to the $HOME/.kube/config directory.
    • If you need to change the configuration location, use the --kubeconfig <file path> flag.
  2. Check the kubectl configuration after adding the credentials:

    $ kubectl config view
    apiVersion: v1
    clusters:
    - cluster:
    certificate-authority-data: DATA+OMITTED
    ...
    

Create a node group

To create a node group:

  1. In management console, select the folder where you want to create your Kubernetes cluster.
  2. In the list of services, select Managed Service for Kubernetes.
  3. Select the Kubernetes cluster to create a node group for.
  4. On the Kubernetes cluster page, go to the Node groups tab.
  5. Click Create node group.
  6. Enter a name and description for the node group.
  7. Specify the Kubernetes version for the nodes.
  8. Specify the number of nodes in the node group.
  9. Under Scalability:
    • Select the scaling policy type.
    • Specify the number of nodes in the node group.
  10. Under Allow when creating and updating, specify the maximum number of instances that you can exceed and reduce the size of the group by.
  11. Under Computing resources:
    • Choose a platform.
    • Specify the required number of vCPUs, guaranteed vCPU performance, and RAM.
    • (optional) Specify that the VM must be preemptible.
  12. Under Storage:
    • Specify the Disk type:
      • HDD: Standard network drive. Network block storage on an HDD.
      • SSD: Fast network drive. Network block storage on an SSD.
    • Specify the disk size.
  13. Under Network settings:
    • In the Public IP field, choose a method for assigning an IP address:
      • Auto: Assign a random IP address from the Yandex.Cloud IP pool.
      • No address: Don't assign a public IP address.
    • Specify how nodes should be distributed across availability zones and networks.
    • (optional) Click Add location and specify an additional availability zone and network to create nodes in different zones.
  14. Under Access, specify the information required to access the node:
    • Enter the username in the Login field.
    • In the SSH key field, paste the contents of the public key file.
  15. Under Maintenance window settings:
    • In the Maintenance frequency / Disable field, choose the maintenance window:
      • Disabled: Automatic updates are disabled.
      • Anytime: Maintenance is allowed at any time.
      • Daily: Maintenance is performed during the interval specified in the Time (UTC) and duration field.
      • On selected days: Maintenance is performed during the interval specified in the Schedule by day field.
  16. Click Create node group.

What's next

  • Read about service concepts.
  • Learn how to work with a Kubernetes cluster and node groups.
In this article:
  • Before you start
  • Create a cluster Kubernetes
  • Add credentials to the kubectl configuration file
  • Create a node group
  • What's next
Language / Region
Careers
Privacy policy
Terms of use
Brandbook
© 2021 Yandex.Cloud LLC