A Complete Guide to Integrating SUSE Rancher with vSphere using Terraform on phoenixNAP
SUSE One Partner, phoenixNAP, is a global Infrastructure as a Service (IaaS) provider with 15+ data centers and PoPs across six continents. With a goal to commoditize enterprise-grade technology and make it accessible to organizations of different sizes, phoenixNAP supports deployment of SUSE Rancher.
As phoenixNAP customer, Glimpse, had chosen a containerized infrastructure path, they created a container-ready infrastructure through integrating various tools like VMware vSphere, HAProxy and more with SUSE Rancher on the phoenixNAP Managed Private Cloud platform. Glimpse developed a deployment guide based on their methodology and we’ve invited phoenixNAP to author a guest blog so you can benefit from their learnings. Cool stuff! ~Bret
SUSE GUEST BLOG AUTHORED BY:
Bojana Dobran, Product Marketing Manager at phoenixNAP
A Complete Guide to Integrating Rancher with vSphere using Terraform
Container enablement has become a priority for teams looking to accelerate software delivery timeframes. By ensuring environment consistency and increased portability, containers enable developers to move applications faster, spend less time managing infrastructure, and save on production environment costs.
The trend of massive container adoption is also present in enterprise, where most business-critical workloads run on VMware vSphere. One way to containerize such applications is to use SUSE Rancher, the only container management platform allowing for Kubernetes deployment on any infrastructure. SUSE Rancher eliminates the need for building a custom container services platform and provides organizations with a critical capability to modernize their IT.
A detailed use case for deploying Kubernetes clusters on a vSphere-based environment using SUSE Rancher is provided by developers from Glimpse, an online membership platform, running on phoenixNAP’s Managed Private Cloud (MPC).
Background on Glimpse and phoenixNAP
As a fast-growing online subscription business platform, Glimpse has used phoenixNAP’s VMware-based Managed Private Cloud (MPC) solution for several years. In its effort to adopt DevOps tools and methodologies, Glimpse was looking to deploy Kubernetes on MPC and containerize its production workloads. To achieve that, they used SUSE Rancher in combination with Terraform tools.
The full process of integrating SUSE Rancher and vSphere is documented in this guide and on phoenixNAP’s GitHub. Below is a summary of what the guide includes.
Integrating SUSE Rancher and vSphere
Enabling integration between VMware vSphere and SUSE Rancher is a multi-step process. The Glimpse team used the following tools to enable the integration:
- VMware vSphere for infrastructure and network management
- HAProxy for load balancing
- Hashicorp Packer for golden image creation
- Hashicorp Terraform for SUSE Rancher integration
- SUSE Rancher for Kubernetes deployment
While some integration steps were relatively straightforward, others required a certain degree of customization. The first step was to allow SUSE Rancher and Terraform to access the existing vSphere environment, which required creation of dedicated users and network. DHCP in vSphere needed to be temporarily enabled to allow Hashicorp Packer builds to get an IP address, but the template should be shut down as soon as the build is completed. A recommended best practice for this step is to create a separate folder in vSphere for Rancher and Kubernetes files. In addition to this, Network Policy Profiles also need to be specified for security reasons.
Below is a table with initial requirements for the SUSE Rancher and vSphere integration on MPC.
Building a Golden Image with Hashicorp Packer
The next step to enabling SUSE Rancher and vSphere integration is creation of a golden image. Glimpse team chose to do this using Hashicorp Packer as it enables programmatic creation of golden images and continuous deployment.
The image can be created using the available template builders and installed using provisioners. Resource configuration details can be defined through cloud-init
, so that the image can be deployed with pre-defined dependencies automatically.
The complete guide also contains the sript.sh
file with different workarounds that need to be implemented for Rancher.
Provisioning Rancher Using Terraform
Glimpse used HashiCorp Terraform to provision a highly available Rancher cluster. The main.tf
file in their example contains Rancher configuration such as information about providers, templates, provisioners, and vSphere environment, so it can be bootstrapped automatically.
The steps needed for provisioning include collecting essential vSphere data sources, generating templates, and creating a load balancer.
Creating a Kubernetes Cluster using Rancher
Once Rancher has been provisioned, the next step is to spin up a Kubernetes cluster using a Rancher machine. This can be done programmatically via HashiCorp Terraform, as demonstrated by the Glimpse team on MPC.
In this example, they used backend.tf
file to store the IP address of Consul. As an alternative to Consul, local storage can be used. The specific steps involve:
- Creating API access keys for the Rancher module
- Defining paths and templates in
variables.tf
file - Deploying master and worker nodes
- Creating node templates
Once all the steps are completed, a Kubernetes cluster will be deployed and ready to be managed. The cluster can be easily managed through Rancher UI, which offers intuitive options for node management. In the Cluster Explorer option in SUSE Rancher, all the cluster information including time of creation, the number of resources, namespaces, etc., will be immediately visible.
With all your clusters in a single-pane-of-glass view, SUSE Rancher is making it possible to offload complex infrastructure management tasks, regardless of the platform you are using. This example of integration with vSphere is intended to help save time on containerizing your own vSphere-based applications.
For full guide, visit phoenixNAP website and download your free copy.
The code for this integration is available on phoenixNAP’s GitHub.
phoenixNAP also provides a solution for simplified deployment of physical servers with pre-installed SUSE Rancher software within its Bare Metal Cloud platform. Enabling automated provisioning of dedicated servers through API, CLI, or Infrastructure as Code tools, Bare Metal Cloud helps automation-driven organizations and DevOps teams simplify their infrastructure management tasks.
As a Product Marketing Manager at phoenixNAP, Bojana helps develop and document use cases for the company’s infrastructure solutions. Her extensive experience in technical and marketing writing helps her present complex concepts the simple way.
Related Articles
Jun 15th, 2023