You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
3.4 KiB

  1. # Equinix Metal
  2. Kubespray provides support for bare metal deployments using the [Equinix Metal](http://metal.equinix.com).
  3. Deploying upon bare metal allows Kubernetes to run at locations where an existing public or private cloud might not exist such
  4. as cell tower, edge collocated installations. The deployment mechanism used by Kubespray for Equinix Metal is similar to that used for
  5. AWS and OpenStack clouds (notably using Terraform to deploy the infrastructure). Terraform uses the Equinix Metal provider plugin
  6. to provision and configure hosts which are then used by the Kubespray Ansible playbooks. The Ansible inventory is generated
  7. dynamically from the Terraform state file.
  8. ## Local Host Configuration
  9. To perform this installation, you will need a localhost to run Terraform/Ansible (laptop, VM, etc) and an account with Equinix Metal.
  10. In this example, we're using an m1.large CentOS 7 OpenStack VM as the localhost to kickoff the Kubernetes installation.
  11. You'll need Ansible, Git, and PIP.
  12. ```bash
  13. sudo yum install epel-release
  14. sudo yum install ansible
  15. sudo yum install git
  16. sudo yum install python-pip
  17. ```
  18. ## Playbook SSH Key
  19. An SSH key is needed by Kubespray/Ansible to run the playbooks.
  20. This key is installed into the bare metal hosts during the Terraform deployment.
  21. You can generate a key new key or use an existing one.
  22. ```bash
  23. ssh-keygen -f ~/.ssh/id_rsa
  24. ```
  25. ## Install Terraform
  26. Terraform is required to deploy the bare metal infrastructure. The steps below are for installing on CentOS 7.
  27. [More terraform installation options are available.](https://learn.hashicorp.com/terraform/getting-started/install.html)
  28. Grab the latest version of Terraform and install it.
  29. ```bash
  30. echo "https://releases.hashicorp.com/terraform/$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r -M '.current_version')/terraform_$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r -M '.current_version')_linux_amd64.zip"
  31. sudo yum install unzip
  32. sudo unzip terraform_0.14.10_linux_amd64.zip -d /usr/local/bin/
  33. ```
  34. ## Download Kubespray
  35. Pull over Kubespray and setup any required libraries.
  36. ```bash
  37. git clone https://github.com/kubernetes-sigs/kubespray
  38. cd kubespray
  39. ```
  40. ## Install Ansible
  41. Install Ansible according to [Ansible installation guide](/docs/ansible.md#installing-ansible)
  42. ## Cluster Definition
  43. In this example, a new cluster called "alpha" will be created.
  44. ```bash
  45. cp -LRp contrib/terraform/packet/sample-inventory inventory/alpha
  46. cd inventory/alpha/
  47. ln -s ../../contrib/terraform/packet/hosts
  48. ```
  49. Details about the cluster, such as the name, as well as the authentication tokens and project ID
  50. for Equinix Metal need to be defined. To find these values see [Equinix Metal API Accounts](https://metal.equinix.com/developers/docs/accounts/).
  51. ```bash
  52. vi cluster.tfvars
  53. ```
  54. * cluster_name = alpha
  55. * packet_project_id = ABCDEFGHIJKLMNOPQRSTUVWXYZ123456
  56. * public_key_path = 12345678-90AB-CDEF-GHIJ-KLMNOPQRSTUV
  57. ## Deploy Bare Metal Hosts
  58. Initializing Terraform will pull down any necessary plugins/providers.
  59. ```bash
  60. terraform init ../../contrib/terraform/packet/
  61. ```
  62. Run Terraform to deploy the hardware.
  63. ```bash
  64. terraform apply -var-file=cluster.tfvars ../../contrib/terraform/packet
  65. ```
  66. ## Run Kubespray Playbooks
  67. With the bare metal infrastructure deployed, Kubespray can now install Kubernetes and setup the cluster.
  68. ```bash
  69. ansible-playbook --become -i inventory/alpha/hosts cluster.yml
  70. ```