Skip to content

Demo script for provisioning a Kubernetes cluster via API on Bare Metal Cloud

Notifications You must be signed in to change notification settings

phoenixnap/python-k8s-demo-bmc

Repository files navigation


phoenixnap Bare Metal Cloud
Kubernetes on Bare Metal Cloud Demo Script

Demo script for provisioning Bare Metal Cloud servers via API. This script creates a Kubernetes cluster consisting of 3 Ubuntu servers (1 master node and 2 workers nodes) with a WordPress installation.

Bare Metal CloudAPIDevelopers PortalKnowledge BaseSupport

Requirements

Creating a Bare Metal Cloud account

  1. Go to the Bare Metal Cloud signup page.
  2. Follow the prompts to set up your account.
  3. Use your credentials to log in to Bare Metal Cloud portal.

▶️ Video tutorial: How to Create a Bare Metal Cloud Account

▶️ Video tutorial: Introduction to Bare Metal Cloud

API Credentials

You need valid Bare Metal Cloud API credentials to use this script. Follow these steps to obtain your API credentials:

  1. Log in to the Bare Metal Cloud portal.
  2. On the left side menu, click on API Credentials.
  3. Click the Create Credentials button.
  4. Fill in the Name and Description fields, select the permissions scope and click Create.
  5. In the table, click on Actions and select View Credentials from the dropdown to view the Client ID and Client Secret.

Bare Metal Cloud Quick Start Guide: https://developers.phoenixnap.com/quick-start

Setup

  1. Execute the command: pip install -r requirements.txt

  2. Set your credentials in credentials.conf.

  3. Set a public key in server-settings.conf, you can see your default public key with this command: cat ~/.ssh/id_rsa.pub.

  4. To execute the script, run this command: python3 k8s-demo.py

Script details

K8S setup progress

Once the script is ready and the master node has configured the local kubectl, the script will open a new terminal window which will display the K8S setup progress (be patient to see all components). The script execution will not tbe affected if you close th terminal window.

URLs

The script will check if the cluster is set up properly. You will get a URL to access the master node via web UI and a token to access to the Kubernetes admin dashboard, as well as the Wordpress installation.

  • Kubernetes admin dashboard URL:

    1. Copy the URL from the KUBERNETES DASHBOARD INFO and paste it into your browser.
    2. You will get a certificate warning since you don't have an SSL certificate. You can ignore the warning and click on Advance... and then Accept the risk and continue.
    3. Select the token option and paste the token provided by the script.
  • Wordpress URL:

    1. Copy the URL from the WORDPRESS DASHBOARD INFO and paste it into your browser to access WordPress.

Release

To release the servers, use the command: python3 k8s-demo.py -d0.

Bare Metal Cloud community

Become part of the Bare Metal Cloud community to get updates on new features, help us improve the platform, and engage with developers and other users.

Resources

Documentation

Contact phoenixNAP

Get in touch with us if you have questions or need help with Bare Metal Cloud.

TwitterFacebookLinkedInInstagramYouTubeEmail


phoenixnap Bare Metal Cloud