cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
476
Views
5
Helpful
0
Comments
Geevarghese Cheria
Cisco Employee
Cisco Employee

If you want to deploy an application where you need a wide range of team interaction, you often face a slow process and a high risk of lack of standardization. Imagine a web shop company with name xyz about to deploy a new application. So, the company developer contacts the infrastructure person and asks for a secure and flexible infrastructure to develop an application.

This article will go through a  step-by-step approach on how to deploy a Hybrid Cloud environment , using Cisco Intersight Platform. You will learn how to use infrastructure as code (e.g. Terraform) together with Intersight.

Adopting Infrastructure as Code allows your infrastructure and operations team to leverage the same agile practices that application developers use. Cisco Intersight automates the operations management of IT infrastructure from the data center to the edge. Cisco Intersight Service for HashiCorp Terraform (IST) addresses the challenge for securely connecting and configuring on-premises environments to work with Terraform Cloud Business. With the integration of Cisco's Intersight and Hashicorp's Terraform Cloud Business, multi-cloud resources orchestration can now be done in a single pane of glass provided by Intersight.

The Infrastructure team must describe the target configuration as code and then push it to Git,( Git is a Version Control System (VCS). Version Control Systems record file changes over time, giving you the ability to recall previous revisions and see the history of changes.) where it will trigger Terraform.  Terraform introduces a standardized workflow. Its a command line utility. You need to write some Terraform configurations against a cloud platform or a private data center, which acts as a Provider. A Provider uses Technologies APIs and abstracts and simplifies it to codify the infrastructure in a declarative way.

1.png

See the above diagram for the workflow.

1) Install Terraform on a laptop

2) Get configuration from GitHub  - [https://github.com/sandkum5/terraform-intersight-hx-edge-deploy].

3) Initialize the Terraform open-source tool and run the "terraform init" command. This will check the syntax of our Terraform config files and make sure that there are no syntax errors. It will examine any providers that have been defined in those configurations and attempt to reach out to the public location where it can find those providers. In this case the provider would be (Cisco Intersight’s Terraform Provider, now available in the Terraform Registry at https://registry.terraform.io/providers/CiscoDevNet/intersight/latest.)

4) Now we run the  “ terraform plan”  command which will talk to the API endpoint of the provider and do a dry run. For example, we will spin up a Kubernetes cluster with the provider. This tells us what the output will be without actually deploying the app.

5) The next step will be to apply the changes. When you pass the command “terraform apply” Terraform will reach out to the provider and act on your behalf in a declarative manner. This orchestrates the steps necessary to configure and deploy the resources you defined, and the end result is what's known as a state file. The state file is in JSON format.

 

2.png

Source - Cisco Intersight Service for Terraform

The purpose of the Terraform state file- A state file in Terraform stores the current knowledge of the state of the configured infrastructure, which reduces the complexity of the resource deployment when you are handling large Enterprise infrastructures.

If you want to spin up a Kubernetes cluster please check on the provider and see wether that service is present or not.

1.png

Demo

First, you need to have a Terraform Cloud for business account. - https://www.hashicorp.com/products/terraform/pricing

Navigate to this URL - https://learn.hashicorp.com/tutorials/terraform/cloud-agents?in=terraform/cloud to see that it is via the self-hosted Terraform Cloud agents, which we manage an isolated, private, or on-premises infrastructure.

1.png

Now  lets go to the organization which you have created on the Terraform cloud. Go to the API Tokens section. For Cisco Intersight to interact with Terraform cloud you need an API token. But before that lets see the Agent menu as shown below.

1.png

Click on API Tokens below (On the side menu) and navigate to User settings page for creating an API token.

1.png

This will open a window as shown below.

1.png

If you already have an existing token you may use it  or If you want a new token, click on "Create an API token" button and enter the description. 

Your next step is to login to Intersight and claim a Terraform API end point. Use the Terraform Token which you have mentioned in the above step to claim Terraform Cloud targets. Navigate to the Intersight UI by going to Admin->Targets and click on Claim Target.

1.png

On the window below search for Terraform.

1.png

select the Terraform cloud as the end point and click on Start.

1.png

Now on the window below, you need to provide a Terraform username, user API token, and default Terraform Organization.

1.png

On clicking the "Claim" button you can see that the Terraform API endpoint  got registered on Intersight.

1.png

Next step is you need to claim a Terraform Agent. As mentioned in the picture below on Intersight's UI, go to Admin->Targets and find our Terraform Cloud Target and Claim Terraform Cloud Agent.

1.png

While claiming an Agent, you need to provide Intersight Assist and Terraform Cloud Organization/Agent pool information.  

Once you click on "Claim" you can see the agent got configured.

1.png

Next let’s navigate to the Terraform end point and launch Terraform cloud.

1.png

This will open the Terraform cloud workspace as below.

1.png

Now let’s go to settings and check for Agents. You can see the new agent that you had claimed at Intersight.

1.png

Now Let’s naviagte to another workspace from another organization for creating Kubernetes cluster using the terraform script written and uploaded from GitHub…[Source  - Cisco Live event  - Real Life Deployment of Hybrid Cloud Infrastructure using Intersight - BRKCLD-2807]

1.png

Before the creation of the cluster policies and IP Pools need to be setup.

1.png

Open "BRKCLD-2807" workspace and Queue a plan manually. Check for status of Run. If successful, it should look something like this:

1.png

1.png

Once policies are configured successfully, PROD K8s cluster can be provisioned.

1.png

This will start Intersight workflow automatically.

1.png

1.png

Once the workflow is complete, you can see that the Kubernetes cluster is up and running.

1.png

You can also see the profile status.

1.png

At this point you may download the cluster kubeconfig from Intersight and run "kubectl get nodes" to verify the operational cluster:

1.png

Summary: Congratulations, you’ve understood the concepts such as infrastructure as code, hybrid cloud, kubernets, Terraform, Cisco Intersight and have done a Kubernetes cluster deployment on the Cisco Hybrid Cloud infrastructure. 

Reference:

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links