The bmctl tool is a common-line tool for creating clusters in Anthos clusters on bare metal. The bmctl can automatically set up the necessary Google service accounts and enable required Google Service APIs for Anthos clusters on bare metal installation,
Follow the step for running the bmctl tool –
- First, authenticate with google cloud with your credentials, so you can create and manage service accounts by issuing the following command
> gcloud auth login –update-adc
- Once authenticated, set your google cloud project id for bmctl execution. Please note you need to have Editor or Owner role to the project.
> gcloud config set project <project-id>
- Next execute the bmctl tool to generate the deployment artifacts that would be used for installing the cluster
> bmctl create config -c bm-cluster-demo \
–enable-apis –create-service-accounts –project-id=<project-id>
The above command would enable the required Google APIs for the project (like anthos.googleapis.com and so on), create service accounts with the required roles for the project access and create the configuration file for cluster setup in bmctl-workspace/bm-cluster-demo/ folder as shown in figure below
- Next, edit the bmctl-workspace/bm-cluster-demo/bm-cluster-demo.yaml. The lines highlighted in bold needs to be changed as per below. Look for comments starting with #change. Please note, the file below is a snippet of the generated file.
# bmctl configuration variables. Because this section is valid YAML but not a valid Kubernetes
# resource, this section can only be included when using bmctl to
# create the initial admin/hybrid cluster. Afterwards, when creating user clusters by directly
# applying the cluster and node pool resources to the existing cluster, you must remove this
#change this to path where you have created the ssh key.
#This is name of cluster you can change or leave this as-is
# Cluster type. This can be:
# 1) admin: to create an admin cluster. This can later be used to create user clusters.
# 2) user: to create a user cluster. Requires an existing admin cluster.
# 3) hybrid: to create a hybrid cluster that runs admin cluster components and user workloads.
# 4) standalone: to create a cluster that manages itself, runs user workloads, but does not manage other clusters.
#change type to hybrid.
# Anthos cluster version.
# GKE connect configuration
#Project id that we had specified earlier, leave this as-is
# Control plane configuration
# Control plane node pools. Typically, this is either a single machine
# or 3 machines if using a high availability deployment.
– address: 10.200.0.3
#Change address to ip address of the control plane node – 10.200.0.3, that we had
#configured as part of VLAN earlier
# Cluster networking configuration
# Pods specify the IP ranges from which pod networks are allocated.
# Services specify the network ranges from which service virtual IPs are allocated.
# This can be any RFC1918 range that does not conflict with any other IP range
# in the cluster and node pool resources.
# Load balancer configuration
# Load balancer mode can be either ‘bundled’ or ‘manual’.
# In ‘bundled’ mode a load balancer will be installed on load balancer nodes during cluster creation.
# In ‘manual’ mode the cluster relies on a manually-configured external load balancer.
# Load balancer port configuration
# Specifies the port the load balancer serves the Kubernetes control plane on.
# In ‘manual’ mode the external load balancer must be listening on this port.
# There are two load balancer virtual IP (VIP) addresses: one for the control plane
# and one for the L7 Ingress service. The VIPs must be in the same subnet as the load balancer nodes.
# These IP addresses do not correspond to physical network interfaces.
# ControlPlaneVIP specifies the VIP to connect to the Kubernetes API server.
# This address must not be in the address pools below.
#change Control Plane VIP to 10.200.0.49, based on our VLAN configuration
# IngressVIP specifies the VIP shared by all services for ingress traffic.
# Allowed only in non-admin clusters.
# This address must be in the address pools below.
#Uncomment ingressVIP and change Ingress Plane VIP to 10.200.0.50, based on our
# AddressPools is a list of non-overlapping IP ranges for the data plane load balancer.
# Address pool configuration is only valid for ‘bundled’ LB mode in non-admin clusters.
– name: pool1
# # Each address must be either in the CIDR form (184.108.40.206/24)
# # or range form (220.127.116.11-18.104.22.168).
#Uncomment addressPools and add Load Balancer IP ranges 10.200.0.50-10.200.0.70
#based on our VLAN configuration
# A load balancer node pool can be configured to specify nodes used for load balancing
# Cloud project for logs and metrics.
# Cloud location for logs and metrics.
# Node pools for worker nodes
– address: 10.200.0.4
– address: 10.200.0.5
#Change address to IP address of our worker nodes – 10.200.0.4 and 10.200.0.5
# based on our VLAN configuration
- Save the file and exit the editor.
- Next create the cluster by running the following command
> bmctl create cluster -c bm-demo-cluster
The bmctl runs various preflight checks on your environment to ensure it meet the hardware specifications, network connectivity between cluster machines, Load Balancer node is on L2 network and other conditions to ensure the Anthos cluster can be installed on the nodes specified in the deployment configuration.
The bmtcl tool takes a while to run (around 30 – 45 minutes) and following messages would be displayed as shown in figure below.