This page explains how to configure static IPs for use with GKE On-Prem clusters.
Overview
During installation, you generate a GKE On-Prem configuration file.
The configuration file you generate includes two ipblockfilepath
fields:
admincluster.ipblockfilepath
usercluster.ipblockfilepath
.
The ipblockfilepath
accepts the path to a YAML file containing a hostconfig
configuration, described below.
If you want to use static IPs, you need to create two YAML files in your admin
workstation, one containing a hostconfig
to be used by your admin
cluster and another to be used by your user clusters.
Before you begin
- You need a minimum of N + 4 IP/hostname pairs in the admin cluster IP configuration, where N is the number of user clusters you plan to create.
- You can choose to create a high availability user cluster. A HA user cluster uses three user control planes. Each VM that runs a user control plane requires its own static IP.
Example
The following is an example of a hostconfig
file with three hosts. Your file
might look different depending on your environment. For example, you might
expand the ips
array with more ip
/hostname
pairs:
hostconfig: dns: 8.8.8.8 # IPv4 address of DNS server used by nodes tod: 192.138.210.214 # IPv4 address of the NTP server used by the nodes blocks: - netmask: 255.255.252.0 gateway: 110.116.232.1 ips: - ip: 10.116.232.23 hostname: host1.enterprise.net # will be trimmed to host1 - ip: 10.116.232.65 hostname: host2.enterprise.net # will be trimmed to host2 - ip: 10.116.232.66 hostname: host3.enterprise.net # will be trimmed to host3
The YAML file contains two sections, hostconfig
and blocks
.
hostconfig
hostconfig
contains networking parameters that apply statically to
all of your user cluster's nodes. hostconfig
configures two values:
dns
: IP address of DNS server to use for nodes.tod
: the time server's IP address.
blocks
blocks
contains an array of static IP addresses blocks. Currently,
GKE On-Prem only considers the first block for IP allocation.
Each block represents a network and its IP addresses within it.
netmask
and gateway
netmask
and gateway
represent the network mask and default gateway to
use for nodes.
blocks: - netmask: 255.255.252.0 gateway: 110.116.232.1
ips
An ips
array lists the IPs you've allocated. Each object in the array
contains an IPv4 address and its
hostname:
blocks: ... ips: - ip: [IPV4_ADDRESS] hostname: [HOSTNAME] - ip: [IPV4_ADDRESS] hostname: [HOSTNAME] - ip: [IPV4_ADDRESS] hostname: [HOSTNAME] ...
GKE On-Prem keeps tracks of free and assigned IP addresses within this block, and allocates one available IP address to each node in a user cluster. Ensure that the number of IP addresses in the array is strictly greater than the number of nodes in the user cluster, and that each IP address is unique to your environment's network.
hostname
, interpreted as the local hostname without its domain. If you
specify a fully-qualified domain name (FQDN), the domain name is trimmed. For
example, host1.enterprise.net
becomes host1
. hostname
values must be
lowercase.
Creating hostconfig
file
To create the hostconfig
files from your admin workstation:
Copy the following template to a YAML file:
hostconfig: dns: tod: blocks: - netmask: gateway: ips: - ip: hostname: - ip: hostname: - ip: hostname:
Save the files by different names, like
admin-cluster-hostconfig.yaml
anduser-cluster-hostconfig.yaml
.During installation, modify the configuration file's
admincluster.ipblockfilepath
andusercluster.ipblockfilepath
fields with the appropriate files.
Troubleshooting
For more information, refer to Troubleshooting.