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 Cloud • API • Developers Portal • Knowledge Base • Support
- Bare Metal Cloud account
- Python 3
- Go to the Bare Metal Cloud signup page.
- Follow the prompts to set up your account.
- Use your credentials to log in to Bare Metal Cloud portal.
You need valid Bare Metal Cloud API credentials to use this script. Follow these steps to obtain your API credentials:
- Log in to the Bare Metal Cloud portal.
- On the left side menu, click on API Credentials.
- Click the Create Credentials button.
- Fill in the Name and Description fields, select the permissions scope and click Create.
- 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
-
Execute the command:
pip install -r requirements.txt
-
Set your credentials in
credentials.conf
. -
Set a public key in
server-settings.conf
, you can see your default public key with this command:cat ~/.ssh/id_rsa.pub
. -
To execute the script, run this command:
python3 k8s-demo.py
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.
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:
- Copy the URL from the
KUBERNETES DASHBOARD INFO
and paste it into your browser. - You will get a certificate warning since you don't have an SSL certificate. You can ignore the warning and click on
Advance...
and thenAccept the risk and continue
. - Select the token option and paste the token provided by the script.
- Copy the URL from the
-
Wordpress URL:
- Copy the URL from the
WORDPRESS DASHBOARD INFO
and paste it into your browser to access WordPress.
- Copy the URL from the
To release the servers, use the command: python3 k8s-demo.py -d0
.
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.
- Follow @phoenixNAP on Twitter
- Join the official Slack channel
- Sign up for our Developers Monthly newsletter
Get in touch with us if you have questions or need help with Bare Metal Cloud.