Part 3: Deploy Application¶
Steps¶
1. Configure CPEM¶
As part of creating our Kubernetes cluster in the last section, Cluster API Provider Packet installed Cloud Provider Equinix Metal for us. We will now configure it to set up service load balancers for us.
-
Delete current secret file
-
Create a new secret file
For example, create a file named
cloud-sa.json
with the following content:`Text Only{ "apiKey": "<YOUR_API_KEY>", "projectID": "<YOUR_PROJECT_ID>", "metro": "<YOUR_METRO>", "loadbalancer": "emlb:///<YOUR_METRO>" }
It might look like the following for our example in the Dallas metro:
-
Apply the new secret file
-
Restart the cloud provider
-
Make sure Cloud Provider Equinix Metal has come back up, it should look like the below. If it doesn't say Running in the STATUS column, that could indicate a problem in your cloud-sa.json file you created earlier or that you forgot to
kubectl create
the secret using that file.
2. Deploy NGINX¶
-
Deploy a sample application
Here we'll deploy a sample application to test the load balancer. We'll use the nginx deployment example from the Kubernetes documentation. This will set up a website that we can access through the load balancer.
-
Expose the aplication
-
Wait for the load balancer to be created. This may take a few minutes.
Keep running the following command and watch for the External IP address column to have a value and not say Pending...
-
You should now be able to visit the IP address listed in the EXTERNAL_IP column in your browser and see the default nginx page.
-
Investigate the load balancer and its origin pool on the portal.
-
Go to the Equinix Metal portal and navigate to the project you are using.
-
Click on the Load Balancers tab. Your new load balancer should be listed and start with "usage=cloud-provider" it should look like below.
-
Click on that load balancer and go to "Listener Ports" and you should see the listener port that was created, like below.
-
Click on the "Manage Pool" and it'll take you to the origin pool for the Load Balancer, which should look similar to below:
Discussion¶
Before proceeding to the next part let's take a few minutes to discuss what we did. Here are some questions to start the discussion.
- What is Cloud Provider Equinix Metal?
- What is the purpose of the cloud-sa.json file?