Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Automate Red Hat OpenShift on Alibaba Cloud

Reference implentation of OpenShift deployments on Alibaba Cloud

October 24, 2024
Julio Faerman
Related topics:
Automation and managementDevOps
Related products:
Red Hat OpenShift

Share:

    For many customers, running Red Hat OpenShift on Alibaba Cloud can be the architecture of choice for efficient hybrid cloud solutions. However, automating the deployment of clusters can be troublesome, as there are many alternatives to consider and some development required. This article offers a reference implementation to help you deploy Red Hat OpenShift clusters on Alibaba Cloud infrastructure using the Assisted Installer. 

    All code referenced in this article may be found here. Please review the code and configuration before executing, as described in this document. 

    Disclaimer

    This repository is maintained exclusively by its contributors as a community effort. It is not supported by Red Hat or Alibaba.

    Deployment guide

    Follow this process to provision your cloud resources and install an OpenShift Cluster automatically on Alibaba Cloud. Here’s a recorded demonstration of the entire process: Create an OpenShift cluster on Alibaba Cloud.

    Account creation

    Make sure you have access to the following cloud services:

    • Red Hat Hybrid Console
    • Alibaba Cloud

    Workspace setup

    The lab-aliyun repository on GitHub includes an example GitPod configuration, so you can start a workspace with all tools ready to work.

    If you prefer, you're welcome to clone this repository and set up your own machine. The exact dependencies and commands can be found in the GitPod container file (.gitpod.Containerfile).

    Configure the Assisted Installer CLI

    The Assisted Installer service provides us the image for our cluster pre-configured. However, instead of using the web console, we’ll automate the process using the command-line interface (CLI).

    Configure the offline token

    Obtain your Assisted Installer offline token at here and set as an environment variable named AI_OFFLINETOKEN:

    export AI_OFFLINETOKEN="YOUR_TOKEN"

    You can also use dotfiles, DirEnv, or your preferred mechanism to set up environment variables.

    Configure the pull secret

    Log in to the OpenShift Cluster Manager portal, and download your pull secret to a file named openshift_pull.json.

    Verify access to the Assisted Installer Service by listing your clusters with the following command:

    aicli list clusters

    Configure the Alibaba CLI

    Set up authentication of Alibaba CLI as described in Configure Identity Credentials. Make sure your user has access to all resources necessary for the cluster, or assign an administrator-level policy.

    Verify access to Alibaba services by checking your identity:

    aliyun sts GetCallerIdentity

    Set up Alibaba resources

    The file my_cluster_configurations.json contains settings that are going to be used by the scripts.

    Review every setting according to your environment:

    
    {
        "region": "us-east-1",
        "base_domain": "devcluster.mycompany.com",
        "cluster_name_prefix": "someone-",
        "openshift_version": "4.16.2",
        "ssh_public_key_file": "/home/gitpod/.ssh/id_rsa.pub",
        "control_plane_instance_type": "ecs.g6.xlarge",
        "compute_instance_type": "ecs.g6.large",
        "create_sno_cluster": false,
        "create_compact_cluster": false,
        "create_bastion_host": false,
        "bastion_host_image_id": "m-0xi1wndcxhwnxavcodzz",
        "bastion_host_ssh_key_pair": "openshift-dev",
        "resource_group_id": "rg-aek4mzon3le3dse"
    }

    The table below provides a brief description of each setting.

    Setting

    Description

    region

    Alibaba Cloud region where resources will be provisioned.

    base_domain

    DNS zone name where cluster will be created.

    cluster_name_prefix

    Name prefix for the cluster and its resources.

    openshift_version

    OpenShift version to use.

    ssh_public_key_file

    Key file location for server access.

    control_plane_instance_type

    ECS instance type for control plane instances.

    compute_instance_type

    ECS instance type for worker nodes.

    create_sno_cluster

    Create a cluster with control plane and worker in a single node.

    create_compact_cluster

    Create a cluster with contro-plane and workersl in the same nodes, of a three-node cluster.

    create_bastion_host

    Create an extra instance outside of the cluster.

    bastion_host_image_id

    Image to be used for bastion host.

    bastion_host_ssh_key_pair

    Keypair name for bastion host.

    resource_group_id

    Alibaba Resource Manager group ID.

    Code review

    The example scripts in this repository help you provision the cluster, download and convert the image, provision the cloud resources, and install the software. The entrypoint is the lab-aliyun.sh.aliyun script, which invokes each other in turn. The resources are created using Alibaba Resource Orchestration service (ROS), from the template infra/ros/template.ros.yaml. You may want to change that template to include other services, or add that template to your own solution.

    Cluster provisioning

    The entrypoint script lab-aliyun.sh.aliyun can be executed, and all steps should follow automatically. In the end, your cluster will be installed and set up correctly. The scripts create temporary files with logs, images, and resource identities in the root of this repository, where it's expected to execute.

    The first step is to create the cluster in the Assisted Installer service and to obtain the cluster image, so it can be uploaded to Alibaba Cloud and converted to the expected qcow2 format.

    With the image created, the networking and compute infrastructure are provisioned using the Resource Orchestration Service. You can use the Resource Orchestration Service console to verify the provisioning progress. See Figure 1.

    Alibaba Cloud Resource Orchestration Service screen showing the resources created.
    Figure 1: Alibaba Cloud Resource Orchestration Service screen with resources created.

    Cluster installation

    After the resources are provisioned, the lab script starts the cluster installation on the Assisted Installer. This process can take around an hour to complete. You can verify the progress of the installation in each node in the Red Hat Hybrid Cloud Console, as shown in Figure 2.

    Red Hat Hybrid Cloud Console showing the cluster installation process.
    Figure 2: Assisted Installer with cluster installation in progress.

    Troubleshooting

    Although this code was tested and reviewed, it’s possible that some things that may go wrong—do check the logs and console for errors.

    The first checkpoint is to verify that the stack is properly created in Alibaba Cloud Resource Orchestration Service (ROS). If the stack is rolled back, you'll find the reason in the Events tab.

    After that, the cluster will be provisioned in the assisted installer service. You can download the installer logs from the web console.

    Cleanup resources

    If you're no longer using the provisioned cluster, remember to delete the ROS stack (on the Alibaba Cloud Console) and OpenShift Cluster (on the Red Hat Hybrid Cloud Console) to avoid wasting resources or incurring costs.

    Send us your feedback!

    Let us know if this reference implementation was helpful and how it could be improved. Your discussions and contributions are more than welcome in our GitHub Repository.

    Related Posts

    • Introduction to the Red Hat OpenShift deployment extension for Microsoft Azure DevOps

    • How Kubernetes Helps to Enable DevOps

    • Red Hat technologies make open hybrid cloud a reality

    • Using containerization for modern hybrid cloud application development

    Recent Posts

    • Why Models-as-a-Service architecture is ideal for AI models

    • How to run MicroShift as a container using MINC

    • OpenShift 4.19 brings a unified console for developers and admins

    • 3 steps to secure network segmentation with Ansible and AWS

    • Integrate vLLM inference on macOS/iOS using OpenAI APIs

    What’s up next?

    The Red Hat OpenShift cheat sheet presents oc commands for managing an application’s lifecycle.

    Get the cheat sheet
    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue