Skip to main content
User data
Last update:

User data

For your information

The use of user data is not available in Managed Kubernetes clusters on dedicated servers.

User data in a Managed Kubernetes cluster on a cloud server — user parameters for configuring and personalizing the cluster. They are transmitted as a script in cloud-config format (text files with YAML syntax) or as a bash script. The scripts are automatically Base64 encoded and then transferred to the cloud server hosting the Managed Kubernetes cluster. On the server, the scripts are executed using the agent cloud-init. Using user data helps to speed up and automate the process of configuring a Managed Kubernetes cluster.

Specify user data can be done when creating a cluster or adding a new group of nodes.

Read more about cloud-config and bash script formats in the instructions User data formats cloud-init documentation.

In scripts, you can pass parameters to configure worker nodes and install additional software on nodes outside the Managed Kubernetes cluster. For example:

Specify user data

You can specify user data by Create a cluster on a cloud server or adding a new node group:

  • in the control panel — script with data that are not Base64 encoded, in the field User Data. The maximum size of the script is 47 KB;
  • via Terraform — only a script with data encoded in Base64, in the argument user_data. The maximum script size is 65,535 bytes.

Once user data has been added, the script cannot be changed.

Examples of user data

Disable IPv6

#cloud-config

runcmd:
- echo "options ipv6 disable=1" >> /etc/modprobe.d/ipv6.conf
- sysctl -a
- DisableIPv6Conf="/etc/sysctl.d/99-ipv6-disable.conf"
- cat /dev/null > $DisableIPv6Conf
- echo '# Custom sysctl Parameter for ipv6 disable' >> $DisableIPv6Conf
- echo 'net.ipv6.conf.all.disable_ipv6 = 1' >> $DisableIPv6Conf
- echo 'net.ipv6.conf.default.disable_ipv6 = 1' >> $DisableIPv6Conf
- sysctl --system
- sysctl -p
- sysctl -a | grep -ie "local_port" -ie "ipv6" | sort

Create a directory and upload files to it over the network

#cloud-config

runcmd:
- mkdir /run/mydir
- [ wget, "http://example.com", -O, /run/mydir/index.html ]