订阅内容

So you want to install your SAP workload on Red Hat OpenShift? The good news is that it’s technically possible. The bad news is that it’s not supported by SAP for production workloads. But assume for a moment that you want to install a development or training or demo system. In that case, you can run your workload in a traditional virtual machine (VM) using OpenShift Virtualization. You want the setup and tuning to be done automatically? There are Ansible roles to cover that. 

First, of course, you need an OpenShift cluster. If you don't already have one, read Installing a user-provisioned cluster on bare meta to learn more about how to set one up, or you can get one from your preferred cloud provider. You can also automate the install.

What is OpenShift Virtualization?

OpenShift Virtualization is a feature of OpenShift that enables you to run and manage both virtualized and containerized workloads together within the Kubernetes-based OpenShift environment. Developed by Red Hat, OpenShift Virtualization provides the ability to unify diverse workloads by allowing you to deploy and manage traditional virtual machines alongside containerized applications. This integration helps you leverage the benefits of both virtualization and containerization, providing better optimized resource utilization, scalability, and flexibility in your IT infrastructure. OpenShift Virtualization is based on KVM, an open-source virtualization technology integrated into the Linux kernel. It is widely used in data centers and cloud environments for its scalability, flexibility, and efficient utilization of hardware resources. OpenShift Virtualization is designed to help simplify the management of mixed workloads, offering a more consistent and efficient solution for running applications across various deployment models within the OpenShift application platform.

Configuring the OpenShift cluster

Your worker nodes must all be identical, with the same amount of RAM, CPUs, disks, and network cards. The network cards must be in the same PCI slots as the ports, which must be named identically.

Next, install the Ansible (version 1.3.5 or above) collection from Ansible galaxy.

# ansible-galaxy collection install community.sap_install

Make sure your KUBECONFIG environment variable is set, and that you're logged into your cluster:

# export KUBECONFIG=$HOME/.kube/config
# oc login

Verify that you're logged in by getting a list of all nodes in your cluster:

# oc get nodes

To start a new deployment, create a working directory and change to it:

# mkdir sap
# cd sap

Create a copy of the example playbook in your working directory, and copy the example variable definition:

# cp ~/.ansible/collections/ansible_collections/community/sap_install/playbooks/sample-sap-hypervisor-redhat_ocp_virt-preconfigure.yml my-sap-deployment.yml
# cp ~/.ansible/collections/ansible_collections/community/sap_install/playbooks/vars/sample-variables-sap-hypervisor-node-preconfigure-rh_ocp_virt.yml my-sap-hypervisor-config.yml

Adjust the my-sap-hypervisor-config.yml configuration to your needs. Each worker node you need configured for SAP workloads must be present in the file. You can also configure a local disk to be used for local storage using the variable sap_hypervisor_node_preconfigure_cluster_config.worker_localstorage_device.

It’s important that you add at least one storage class to the cluster, either localstorage or NFS, with the help of this role or later manually before you deploy your first VM.

You can also configure networks, as shown in the example.

Once done with the configuration, it’s time to let Ansible get to work configuring the cluster:

# ansible-playbook -i localhost, my-sap-deployment.yml \
-e @my-sap-hypervisor-config.yml
SAP on Red Hat OpenShift Virtualization

 In case the entry Virtualization does not appear in the OpenShift UI, clear your browser cache.

Create a Virtual Machine

Use the role sap_create_vm from https://github.com/newkitlabs/sap_create_vm to create  virtual machines with the performance tunings for SAP workloads. Ensure that your cluster has a default storage class setup along with enough storage space.

Install the following packages on your jumphost:

# sudo dnf install python3-kubernetes \ 
ansible-collection-kubernetes-core

Use Git to clone the sap_create_vm role in your working directory:

# cd
# mkdir -p data/git
# cd data/git
# git clone https://github.com/newkitlabs/sap_create_vm.git
# cd sap_create_vm

Move or link that checkout to a directory in your Ansible path. Create ~/.ansible/roles if it doesn't exist:

# ln -sf ~/data/git/sap_create_vm/roles/sap_create_vm
~/.ansible/roles/

Make sure you’ve exported your kubeconfig file so it's available to your shell environment:

# export KUBECONFIG=$HOME/.kube/config

To create a VM named sapvm01 with 24GB of RAM and a password of passw0rd, run the following command:

# ansible-playbook -vvv \
--connection=local -i localhost,  playbooks/sap-create-vm.yml \
-e sap_create_vm_names="['sapvm01']" \
-e sap_create_vm_memory=24 \
-e sap_create_vm_cloud_user_passwd=passw0rd

 

SAP on Red Hat OpenShift Virtualization

Prepare the OS for the SAP workload

From the community.sap_install repository, use the role sap_general_preconfigure to configure your OS as necessary. For the installation of SAP HANA, use the role sap_hana_preconfigure and then sap_hana_install. For Netweaver, use sap_netweaver_preconfigure and then sap_swpm.

Install the application

To install the roles on your Ansible path, set the KUBECONFIG environment variable to point at your kubeconfig file. Have a look at the configuration file

sap_hypervisor_node_preconfigure/vars/platform_defaults_redhat_ocp_virt.yml

Create a copy of that file and adjust it to reflect your configuration (localstorage, network and other details).

The simple playbook playbooks/sample-sap-hypervisor-redhat_ocp_virt-preconfigure.yml calls the role and selects the OpenShift Platform through the sap_hypervisor_node_platform variable.

Start the install:

# ansible-playbook -v --connection=local -i localhost, \ sample-sap-hypervisor-redhat_ocp_virt-preconfigure.yml \
-e @<your copy of the config>

This starts the install for you. Once it's complete, test the application to ensure it works as expected.

References


关于作者

Learn and unlearn has been my mantra for the last many years. This has helped me become a better writer, blogger, and content creator. I have been working as a senior technical writer with an interest in blogging. Currently, I am working for Red Hat Enterprise Linux for SAP Solutions.

Read full bio

Started using Linux in the 90's working with SAP since 2013 and being a fan of virtualization and automation.

Read full bio
UI_Icon-Red_Hat-Close-A-Black-RGB

按频道浏览

automation icon

自动化

有关技术、团队和环境 IT 自动化的最新信息

AI icon

人工智能

平台更新使客户可以在任何地方运行人工智能工作负载

open hybrid cloud icon

开放混合云

了解我们如何利用混合云构建更灵活的未来

security icon

安全防护

有关我们如何跨环境和技术减少风险的最新信息

edge icon

边缘计算

简化边缘运维的平台更新

Infrastructure icon

基础架构

全球领先企业 Linux 平台的最新动态

application development icon

应用领域

我们针对最严峻的应用挑战的解决方案

Original series icon

原创节目

关于企业技术领域的创客和领导者们有趣的故事