Setup an Operator SDK on Ubuntu in a Virtual Server Instance

That blog post is about a partly automated setup of an Operator SDK on an Ubuntu Virtual Server Instance on IBM Cloud. The setup is automatically verified by cloning and building an operator bundle.

The automation of the script in the GitHub project uses content from the awesome blog post of my colleague Alain Airom with the topic: How to provision a VSI and Install Docker Tools for Development on IBM Cloud.

Step 1: Create an Ubuntu Virtual Service Instance in a Virtual Private Cloud environment

You can follow the blog post HOW TO CREATE A SINGLE VIRTUAL SERVER INSTANCE (VSI) IN A VIRTUAL PRIVATE CLOUD (VPC) INFRASTRUCTURE ON IBM CLOUD. The difference during the creation of the VSI is that you create an Ubuntu instead of a Centos instance.

Step 1: Clone the project to the local machine

git clone https://github.com/thomassuedbroecker/example-tools-build-container-image.git

Step 2: Navigate to the scripts folder

cd example-tools-build-container-image/scripts

Step 3: Save the actual path as rootfolder

ROOTFOLDER=$(pwd)

Step 4: Get the IP address of your remote machine on IBM Cloud

  • Log on to IBM Cloud
ibmcloud login #-sso
  • Install needed ibmcloud cli plugin
ibmcloud plugin install vpc-infrastructure
  • Define ibmcloud targets and VSI name
export RESOURCE_GROUP=default
export REGION=us-south
export VSI_NAME=EXAMPLE
  • Get VSI IP address
ibmcloud target -g $RESOURCE_GROUP
ibmcloud target -r $REGION
VSI_IP=$(ibmcloud is instances | grep "$VSI_NAME" | awk '{print $5;}')
echo"$VSI_NAME IP: $VSI_IP"

Step 5: Copy the setup-on-unbuntu.sh and setup-on-ubuntu-vsi-brew-operator-sdk.sh to your remote machine

  • Verify your existing private keys
cd ~/.ssh
ls

Note: Maybe you need to clean the known_hosts file

  • Save the key location in a variable
export PATH_TO_PRIVATE_KEY_FILE='~/.ssh/EXAMPLE'
  • Return to the folder we want to copy from
cd $ROOTFOLDER
  • Execute copy of the scripts to your VSI
scp -i $PATH_TO_PRIVATE_KEY_FILE setup-*.sh root@$VSI_IP:/home

  • Example output:
Enter passphrase for key '/Users/thomassuedbroecker/.ssh/EXAMPLE': 
setup-on-ubuntu-vsi-brew-operator-sdk.sh                                                                100%  773     4.6KB/s   00:00    
setup-on-ubuntu-vsi.sh                                                                                  100% 2176    12.8KB/s   00:00 

Step 6: Log in to VSI

ssh -i $PATH_TO_PRIVATE_KEY_FILE root@$VSI_IP

Step 7: In the VSI navigate to the home folder

  • Inside the VSI navigate to the home folder
cd ..
ls
cd home
export ROOT=$(pwd)

Step 8: Run bash setup-on-ubuntu-vsi.shscript

  • Inside the VSI execute following script
sh setup-on-ubuntu-vsi.sh

The script does …

… install:

  • Buildah
  • Kubernetes
  • Docker community addition
  • IBM Cloud CLI and following plugings: container-service, container-registry, code-engine, cloud-databases

… adds a brew user for the brew installation

Step 9: Run bash setup-on-ubuntu-vsi-brew-operator-sdk.sh script

  • Inside the VSI execute following script
cd ..
sh setup-on-ubuntu-vsi-brew-operator-sdk.sh

The script does …

… install:

… clone the Multi Tenancy Frontend Operator project 

… builds a bundle image using the operator-sdk


I hope this was useful to you and let’s see what’s next?

Greetings,

Thomas

#ubuntu, #operatorsdk, #kubernetes, #bundle

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.