You want to deploy a Kubernetes cluster to Azure. You have an Ubuntu Linux server (e.g., with a nano flavor in AWS, a server on-premises, or an one vCPU Azure server with one GB of RAM). It has no software packages installed on it (e.g., it does not have Docker or Kubernetes). How do you deploy Kubernetes into Azure (from an instance in AWS)?
Warning: This will automatically create Azure servers behind the scenes. It will cost money to do this. The conjure-up program uses Juju and will create multiple machines. Your Azure account will be billed if you follow these directions.
You have an Azure account.
1. Create an Ubuntu server. If you are using AWS to deploy Kubernetes to Azure, the EC-2 instance can be the nano flavor or larger. Any Ubuntu server should work as long as it has access to the internet. These directions will work with a server in Azure, AWS or some other on-premises Ubuntu Linux server. If you are using Azure, see this posting.
2. Log into the Ubuntu server. Maximize the Putty session.
3. Run these commands (to install Juju and conjure-up):
sudo apt-get -y update
sudo snap install conjure-up --classic
sudo apt-get -y install juju python libssl-dev libffi-dev python-dev build-essential
juju show-cloud azure # Respond to the prompts. You may want the defaults. An alternative directory for the install is /usr/lib/azure-cli. For az executable, you may want /usr/bin/
curl -L https://aka.ms/InstallAzureCli | sudo bash
juju add-credential azure # The name of the credential is arbitrary; just make one up you'll remember.
# You'll enter your Azure username and password later. For "auth-type" choose "interactive".
# Obtain the subscription ID. Log into the Azure Portal. In the upper right click on your account and then click on "My permissions." You should see an alphanumeric string near your subscription.
# Follow the prompts by opening a web browser from your workstation (separate from the Ubuntu Linux machine you were using) and go to the URL the Ubuntu machine tells you to. Enter the code provided to authenticate.
# Sign in the with your Azure credentials.
4.a. At the menu of choices, choose "Kubernetes core."
4.b. For "Where would you like to deploy?" choose "Azure" and press enter.
4.c. To the next prompt, choose the Azure credentials you added earlier.
5.a. Choose the region in Azure you would like your cluster to go to. Press enter.
5.b. Choose "Deploy New Self-Hosted Controller." Do NOT choose Juju-as-a-Service (JaaS) Managed controller.
6. Enter the password for the ubuntu user at the prompt for a "sudo" password.
7. When prompted, deploy all five remaining items. When you see "Juju Controller is initializing. Please wait." You may observe a delay on the step that says "Attempting to connect to x.x.x.x:22" You may want to make sure your Ubuntu server is in a security group that accepts inbound connections to the IP address x.x.x.x.
8. The unattended process may take 25 minutes. You may want to monitor progress by watching two things. First you may want keep an eye on your Putty session to your Ubuntu virtual server. For example, it will look like this:
In your web browser you may want to log into the Azure Portal. You may also want to refresh your Resources dashboard to watch the new machines being created. Depending on which Azure region you chose, you may need to filter to see that region.
9.a. If your Putty session to your Ubuntu server prompts you, choose "Run" to "Download the kubectl client program to your local host." If you did this, choose "Run" again to the prompt about "kubectl get nodes" etc.
9.b. You may just see "Your deployment is now complete." You'll also see a message that "Kubernetes master is now running at https://x.x.x.x:6443". Go to this URL with a web browser. You will be prompted for credentials. To find these credentials, go to the Putty session and press "Enter" to quit. Then run this command:
kubectl config view
The results of this command will give you credentials for the "admin" user.
10. Remember to delete those new Azure virtual machines or your Azure bill will be higher than you expected.