Skip to main content

Add cloud provider

Monk requires access to your cloud account in order to be able to provision cloud resources on your behalf. Before running a template that provisions instances, load-balancers, volumes etc. you will have to add your cloud provider to Monk.

note

Your credentials are saved by your local Monk instance and shared with other peers within your cluster via encrypted connections on a need-to-know basis. Credentials are never transferred outside of your infrastructure.

Prerequisites

This procedure can be performed only while you're connected to a cluster - either a fresh or existing one. Monk will ask you to create a cluster in case you try the following commands without having a cluster.

Monk will only accept one provider of each kind per cluster. This means that you can have GCP, AWS, Azure and DO providers added at the same time but you can't have eg. two sets of GCP credentials for different projects.

Step 1: Obtaining cloud credentials

  1. Create a new project in your GCP console,
  2. In the new project, go to IAM โ†’ Service Accounts โ†’ CREATE SERVICE ACCOUNT
  3. Assign the Admin role on the project to the account,
  4. On the account list, click three dots and create a JSON Key for the account,
  5. Save the file on your machine eg. in key.json
warning

Service Account Key is sensitive information. You can remove the file from your machine once you configure Monk. The credentials are now stored in an encrypted storage in the monkd database.

Step 2: Adding the provider

In order to add your Service Account key to Monk do:

monk cluster provider add -p gcp -f <<path/to/your-key.json>>

where <<path/to/your-key.json>> is an absolute path to your Service Account key in JSON format.

For example:

monk cluster provider add -p gcp -f ~/myproject/key.json

Successful invocation will result in:

โœ” Provider added successfully

Conclusion

Adding a single provider is enough to start provisioning instances and other resources via Monk. If you have multiple accounts, you can add them the same way by just going back to Step 1 and repeating the process.

Adding providers is usually a one time operation performed on new clusters. Once the credentials are in there is no maintenance required from the user. This action doesn't have to repeated during deployments, even if they happen from different nodes connected to the same cluster. Monk will manage your credentials and use them only when performing actions on the infrastructure relevant to the cluster itself.

Rate this page