July 31, 2019 By Brandon Palm 2 min read

There is a new command to help manage public and private portable subnet resources.

In version 0.3.95 of the IBM Cloud Kubernetes Service CLI plug-in, a new command is introduced to help you manage the public and private portable subnet resources attached your clusters in the IBM Cloud Kubernetes Service:

ibmcloud ks cluster-subnet-detach

If you no longer need subnets from your IBM Cloud classic infrastructure account that you added to a cluster, you can now use this command to easily detach those subnets from your cluster. When you remove a subnet, it is no longer available to your cluster, but it still exists in your IBM Cloud classic infrastructure account.

Listing subnets

After logging in through the IBM Cloud CLI, you can list all existing portable subnets that are available in your IBM Cloud classic infrastructure account by running:

ibmcloud ks subnets

Example output:

ID        Network             Gateway          VLAN ID   Type      Bound Cluster

...

1602829   169.1.1.1/29        169.1.1.2        2234945   public    df253b6025d64944ab99ed63bb4567b6

In the output, note the ID of the subnet and the cluster ID in the Bound Cluster field to use in the detach command. (Note: If you need to find the ID of a cluster, you can run ibmcloud ks clusters.) 

You can further determine which subnets are attached to a cluster by running ibmcloud ks cluster-get --cluster CLUSTER_NAME_OR_ID --showResources and looking for the Subnet CIDRs in the Subnets VLANs section in the output.

Detaching subnets

To detach the subnet, run the following command:

ibmcloud ks cluster-subnet-detach --cluster CLUSTER --subnet-id SUBNET_ID [-f] [-s]

Subnets can only be detached from a cluster if none of the IPs derived from that subnet range are in use in your cluster.

After the subnet is detached, it still remains available in your IBM Cloud account for use with other clusters. If you want to attach it to another cluster, you can run the following command:

ibmcloud ks cluster-subnet-add --cluster CLUSTER_NAME_OR_ID --subnet-id SUBNET_ID

Safely deleting subnets

Now that your subnets are safely detached, you can delete the subnets without causing issues in your Kubernetes cluster. To delete a subnet from your IBM Cloud classic infrastructure account, use the following command:

ibmcloud sl subnet cancel SUBNET_ID

Now, when you run ibmcloud ks subnets, the subnet will no longer appear in the output.

More details

More information can be found in the IBM Cloud Kubernetes Service documentation.

Contact us

If you have questions, engage our team via Slack by registering here and join the discussion in the #general channel on our public IBM Cloud Kubernetes Service Slack.

More from Cloud

Hybrid cloud examples, applications and use cases

7 min read - To keep pace with the dynamic environment of digitally-driven business, organizations continue to embrace hybrid cloud, which combines and unifies public cloud, private cloud and on-premises infrastructure, while providing orchestration, management and application portability across all three. According to the IBM Transformation Index: State of Cloud, a 2022 survey commissioned by IBM and conducted by an independent research firm, more than 77% of business and IT professionals say they have adopted a hybrid cloud approach. By creating an agile, flexible and…

Tokens and login sessions in IBM Cloud

9 min read - IBM Cloud authentication and authorization relies on the industry-standard protocol OAuth 2.0. You can read more about OAuth 2.0 in RFC 6749—The OAuth 2.0 Authorization Framework. Like most adopters of OAuth 2.0, IBM has also extended some of OAuth 2.0 functionality to meet the requirements of IBM Cloud and its customers. Access and refresh tokens As specified in RFC 6749, applications are getting an access token to represent the identity that has been authenticated and its permissions. Additionally, in IBM…

How to move from IBM Cloud Functions to IBM Code Engine

5 min read - When migrating off IBM Cloud Functions, IBM Cloud Code Engine is one of the possible deployment targets. Code Engine offers apps, jobs and (recently function) that you can (or need) to pick from. In this post, we provide some discussion points and share tips and tricks on how to work with Code Engine functions. IBM Cloud Code Engine is a fully managed, serverless platform to (not only) run your containerized workloads. It has evolved a lot since March 2021, when…

Sensors, signals and synergy: Enhancing Downer’s data exploration with IBM

3 min read - In the realm of urban transportation, precision is pivotal. Downer, a leading provider of integrated services in Australia and New Zealand, considers itself a guardian of the elaborate transportation matrix, and it continually seeks to enhance its operational efficiency. With over 200 trains and a multitude of sensors, Downer has accumulated a vast amount of data. While Downer regularly uncovers actionable insights from their data, their partnership with IBM® Client Engineering aimed to explore the additional potential of this vast dataset,…

IBM Newsletters

Get our newsletters and topic updates that deliver the latest thought leadership and insights on emerging trends.
Subscribe now More newsletters