Registering infrastructure resources by using the Mesh CLI

To register your infrastructure resources, you must provide Mesh with details about the cloud and on-prem infrastructure where your applications are running. You can use the CLI to register.

Alternatively, you can register your infrastructure resources by automatic discovery. For information about registering by automatic discovery, see Discovering cloud infrastructure.

Prerequisites

For more information, see Installing the CLI.

Overview

Your infrastructure resources have a hierarchy, and it is necessary to register the resources in order, from the broadest to the most specific:

  • cloud
    • location
    • vpc (virtual private cloud)
      • securitygroup
    • cluster
      • namespace
    • node (virtual machine or bare metal)

Deployment environment is the abstract term Mesh uses for Virtual Private Cloud (VPCs), clusters, and nodes. Partition is the abstract term for namespaces and security groups. The primary purpose of registering your infrastructure is to describe the deployment environments and partitions where your applications run.

Registering clouds

Register each cloud that contains applications you want Mesh to connect. To register a cloud, you use the palmctl create cloud command.

Before you register the cloud resource, decide whether you want to place the discovered resources in the default infrastructure group (called Default_Infrastructure_Group) or in a different resource group.

To put the resources discovered in the Default_Infrastructure_Group, set the following environment variable:
RESOURCE_GROUP_ID='default-infra'

To put the resources discovered in a different resource group, complete the following steps:

  • Create the resource group. For more information, see Resource groups.
  • After you run the palmctl create cloud command, note the value of the resource_id field in the output. Set the value of the shell variable RESOURCE_GROUP_ID to the resource_id value.

To register an AWS cloud, run a command like this:

cat << EOM | palmctl create cloud -f -
name: AWS
type: AWS
is_private: false
EOM
  • The value of the name field can be anything, as long as it is unique.
  • The valid values for type are: IBM, AWS, GCP, Azure, and other.
    Note: You cannot run autodiscovery on clouds of the type other.
  • To represent all of your on-prem data centers, set the following values:
    • Set type to other
    • Set is_private to true
  • No resource group ID is specified, so the discovered resources are placed in Default_Infrastructure_Group.

To register a cloud using environment variables, turn on autodiscover, and provide a secret, run a command like this:

cat << EOM | palmctl create cloud -f -
name: $CLOUD_TYPE
type: $CLOUD_TYPE
auto_discover: true
credentials_key: my-${CLOUD_TYPE}-cloud-secret
resource_group_id: $RESOURCE_GROUP_ID
EOM

Registering cloud locations

Register each location within each cloud that contains your applications. Registering a location is easier if it is one of the known public cloud locations. First, list the public cloud locations by running palmctl get cloudlocations and note the code field of the cloud location that corresponds to your location. Then, use that code in the cloud_location_code field when registering your location.

Example of registering a location associated with an existing public cloud location:

cat << EOM | palmctl create location --cloud-name AWS -f -
name: AWS-east
cloud_location_code: abcdef
is_multi_zone: true
EOM

When registering a location that is not associated with an existing public cloud location (usually an on-prem data center), specify additional fields.

Example of registering a location that is not associated with an existing public cloud location:

cat << EOM | palmctl create location --cloud-name OnPrem -f -
name: Factory-CA
type: region
is_multi_zone: false
city: Los Angeles
region: California
country: United States
geo_coordinates: -118.4068,34.1139
EOM
Notes:
  • The valid values for the type field are site, region, zone.
  • The coordinates in the geo_coordinates field are expressed as longitude, then latitude.

Registering VPCs

Register each VPC that contains your applications. A VPC can be a deployment environment itself (for example, has applications on virtual machines (VMs) in the VPC) or just a container for Kubernetes clusters. In both cases, it should be registered. Use the infra_only field to distinguish between the two cases. For example:

cat << EOM | palmctl create securitygroup --cloud-name AWS --vpc-name 'myvpc' -f -
name: security group 1
EOM

Registering Kubernetes clusters

Register each cluster that is running your applications. If api_end_point, credentials_key, and auto_discover: true are specified, then Mesh will automatically discover the namespaces and applications running in the cluster. For example:

cat << EOM | palmctl create cluster --cloud-name AWS -f -
name: myEKS
location_id: <resource_id from previous command>
type: EKS
is_multi_zone: true
api_end_point: https://mycloud.com/cluster1
credentials_key: /path/to/key/in/SM
auto_discover: true
EOM
Important: The name of the cluster that you create in Mesh must match with the name of the cluster that you deployed in IBM Cloud® or AWS.

Registering cluster namespaces

If you did not configure autodiscovery when registering the clusters, register each namespace in them that is running your applications. For example:

cat << EOM | palmctl create namespace --cloud-name AWS --cluster-name myEKS -f -
name: namespace 1
EOM

Registering nodes

For VMs that are running your applications and are outside of a VPC, register a node resource for it. For example:

cat << EOM | palmctl create node --cloud-name AWS -f -
name: myVM
location_id: <resource_id from previous command>
type: VM
EOM

Accessing help for palmctl commands

Use the following commands to get help information when you view, modify, or delete your infrastructure resources:

palmctl get -h
palmctl update -h
palmctl delete -h