The original 'rancher quickstart' (https://github.com/rancher/quickstart) was not working (for me) anymore. I updated the code and started with Microsoft Azure, Amazon AWS and Google Cloud.
This code will install 2 K3s clusters on SUSE Linux Enterprise Linux. A cluster, managed by a Rancher Management Server, is called a downstream cluster
The first cluster will contain Rancher Management Server and SUSE Security, the second cluster will only containe the K3s distribution, as an example of a managed (downstream) cluster in the Rancher Management Server
What I changed:
- Updated the providers to the latest versions
- Use your own SSH keypair, instead of creating a new one every time
- Save the kubeconfig to a location of choice
- Save ssh link and rancher url to the __k8s directory
- All credential information used will be read from shell environment variables
- A destroy script will be generated which will delete all created resources, this script will be generated at runtime. Please be aware to always check if all resources are deleted.
You will be responsible for any and all infrastructure costs incurred by these resources.
- Install Terraform or Opentofu (it is tested with Terraform)
- Access to a Cloud provider
- Generate a SSH keypair, see https://www.ssh.com/academy/ssh/keygen
- Clone this repository
- Create the needed environment variables with the credentials (see the scripts starting with env-*.sh) and execute it
- For GCP, you do need to login prior to executing via
gcloud - Make a copy of one of the directories in
_master_templateto a directory in the_datacenterdirectory. I strongly suggest to do this and not edit the content of the_master_templatesdirectory - Edit the values in
config.yamlin the newly created directory
Run the initializer for Terraform or Opentofu:
./_init_terraform.sh
Create the resources for the Rancher Management Server and downstream cluster:
./_create.sh
The directory __k8s contains the details for accessing the nodes via ssh and contains the rancher url.
Destroy all resources created for the Rancher Management Server and downstream cluster
./_destroy.sh
Contributors names and contact info
WS
- 0.1
- Initial Release
This project is licensed under the 'Apache License Version 2.0' License - see the LICENSE file for details.
Inspiration, code snippets, etc.