Version 1.11. This version is no longer supported. For more information, see the version support policy. For information about how to upgrade to version 1.12, see Upgrading Anthos on bare metal in the 1.12 documentation.

Available supported versions: 1.14  |   1.13  |   1.12

Create admin clusters in a multi-cluster setup

Stay organized with collections Save and categorize content based on your preferences.

In Anthos clusters on bare metal, you set up admin clusters to manage other clusters securely. You can create, update, upgrade, or delete user clusters from admin clusters. The user clusters run workloads separately from administration, so sensitive information is protected.

Admin clusters managing multi-cluster workloads can provide highly available (HA) reliability. In a HA cluster, if one control plane node fails, other nodes will continue to work.

An admin cluster in a multi-cluster environment provides the best fundamental security. Because access to administration data is separated from workloads, those who access user workloads have no access to sensitive administrative data, like SSH keys and service account data. As a result, there is some trade-off between security and the resources required, since a separate admin cluster means you need dedicated resources for management and workloads.

You create an admin cluster using the bmctl command. After you create an admin cluster, you create user clusters to run workloads.

Prerequisites:

  • Latest bmctl is downloaded (gs://anthos-baremetal-release/bmctl/1.11.8/linux-amd64/bmctl) from Cloud Storage.
  • Workstation running bmctl has network connectivity to all nodes in the target user clusters.
  • Workstation running bmctl has network connectivity to the cluster API server (control plane VIP).
  • SSH key used to create the Admin cluster is available to root, or there is SUDO user access on all nodes in the target admin cluster.
  • Connect-register service account is configured for use with Connect.

See the Anthos clusters on bare metal quickstart for expanded step-by-step instructions for creating a hybrid cluster. Creating an admin cluster is similar to creating a hybrid cluster, except you don't run workloads on the admin cluster.

Enable SELinux

If you want to enable SELinux to secure your containers, you must make sure that SELinux is enabled in Enforced mode on all your host machines. Starting with Anthos clusters on bare metal release 1.9.0 or later, you can enable or disable SELinux before or after cluster creation or cluster upgrades. SELinux is enabled by default on Red Hat Enterprise Linux (RHEL) and CentOS. If SELinux is disabled on your host machines or you aren't sure, see Securing your containers using SELinux for instructions on how to enable it.

Anthos clusters on bare metal supports SELinux in only RHEL and CentOS systems.

Log into gcloud CLI and create an admin cluster config file

  1. Set the default credentials that Anthos clusters on bare metal can use to create the cluster with the following command:

    gcloud auth application-default login
    
  2. To use the automatic API enablement and service account creation features in this page, grant the Project Owner role to that principal. If the principal can't have the Project Owner role, complete the next step.

  3. To ensure the cluster creation can succeed without granting the Project Owner role, add the following IAM roles to the principal:

    • Service Account Admin
    • Service Account Key Admin
    • Project IAM Admin
    • Compute Viewer
    • Service Usage Admin

    If the principal is a service account with those roles, you can run:

    export GOOGLE_APPLICATION_CREDENTIALS=JSON_KEY_FILE
    

    Replace JSON_KEY_FILE with the path to your service account's JSON key file.

  4. Get the ID of your Google Cloud project and store it in an environment variable to use it for cluster creation:

    export CLOUD_PROJECT_ID=$(gcloud config get-value project)
    

Create an admin cluster config with bmctl

After you've logged into gcloud and have your project set up, you can create the cluster config file with the bmctl command.

In the following example, all service accounts are automatically created by the bmctl create config command:

bmctl create config -c ADMIN_CLUSTER_NAME --enable-apis \
    --create-service-accounts --project-id=CLOUD_PROJECT_ID

Replace the following:

  • ADMIN_CLUSTER_NAME: the name of the new cluster.
  • CLOUD_PROJECT_ID: your Google Cloud project ID or the $CLOUD_PROJECT_ID environment variable.

Here's an example to create a config file for a admin cluster called admin1 associated with project ID my-gcp-project:

bmctl create config -c admin1 --create-service-accounts --enable-apis --project-id=my-gcp-project

The file is written to bmctl-workspace/admin1/admin1.yaml.

As an alternative to automatically enabling APIs and creating service accounts, you can also provide your existing service accounts with proper IAM permissions. This means you can skip the automatic service account creation in the previous example in the bmctl command:

bmctl create config -c admin1

Edit the cluster config file

Now that you have a cluster config file, edit it to make the following changes:

  1. Provide the SSH private key to access the admin cluster nodes:

    # 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/admin cluster. Afterwards, when creating user clusters by directly
    # applying the cluster and node pool resources to the existing cluster, you must remove this
    # section.
    gcrKeyPath: bmctl-workspace/.sa-keys/my-gcp-project-anthos-baremetal-gcr.json
    sshPrivateKeyPath: /path/to/your/ssh_private_key
    gkeConnectAgentServiceAccountKeyPath: bmctl-workspace/.sa-keys/my-gcp-project-anthos-baremetal-connect.json
    gkeConnectRegisterServiceAccountKeyPath: bmctl-workspace/.sa-keys/my-gcp-project-anthos-baremetal-register.json
    cloudOperationsServiceAccountKeyPath: bmctl-workspace/.sa-keys/my-gcp-project-anthos-baremetal-cloud-ops.json
    
  2. For 1.7.0 and later versions, you must register your clusters with Connect to your project environ.

    • If you created your config file, using the automatic API enablement and Service Account creation features, you can skip this step.
    • If you created the config file without using the automatic API enablement and Service Account creation features, reference the downloaded service account JSON keys in the corresponding gkeConnectAgentServiceAccountKeyPath and gkeConnectRegisterServiceAccountKeyPath fields of the cluster config file.
  3. Check to make sure the config specifies a cluster type of admin (the default value):

    spec:
      # 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.
      type: admin
    
  4. Change the configuration file to specify a multi-node, high availability, control plane. Specify an odd number of nodes to have a majority quorum for HA:

      # Control plane configuration
      controlPlane:
        nodePoolSpec:
          nodes:
          # Control plane node pools. Typically, this is either a single machine
          # or 3 machines if using a high availability deployment.
          - address: 10.200.0.4
          - address: 10.200.0.5
          - address: 10.200.0.6
    
  5. Specify the pod density of cluster nodes and the container runtime:

    ....
    # NodeConfig specifies the configuration that applies to all nodes in the cluster.
    nodeConfig:
      # podDensity specifies the pod density configuration.
      podDensity:
        # maxPodsPerNode specifies at most how many pods can be run on a single node.
        maxPodsPerNode: 250
      # containerRuntime specifies which container runtime to use for scheduling containers on nodes.
      # containerd and docker are supported.
      containerRuntime: containerd
    ....
    

    For admin clusters, allowable values for maxPodsPerNode are 32-250 for HA clusters and 64-250 for non-HA clusters. The default value if unspecified is 110. Once the cluster is created, this value cannot be updated.

    The default container runtime is containerd. Alternatively, you can use Docker. For more information about changing your runtime, see our Change your container runtime guide.

    Pod density is also limited by your cluster's available IP resources. For details, see Pod networking.

Create the admin cluster with the cluster config

Use the bmctl command to deploy the cluster:

bmctl create cluster -c ADMIN_CLUSTER_NAME

ADMIN_CLUSTER_NAME specifies the cluster name created in the previous section.

The following shows an example of the command to create a cluster called admin1:

bmctl create cluster -c admin1

Sample admin cluster configurations

For example admin cluster configurations, see Admin clusters in the Cluster configuration samples.