3 Kubespray provides support for bare metal deployments using the [Equinix Metal](http://metal.equinix.com).
4 Deploying upon bare metal allows Kubernetes to run at locations where an existing public or private cloud might not exist such
5 as cell tower, edge collocated installations. The deployment mechanism used by Kubespray for Equinix Metal is similar to that used for
6 AWS and OpenStack clouds (notably using Terraform to deploy the infrastructure). Terraform uses the Equinix Metal provider plugin
7 to provision and configure hosts which are then used by the Kubespray Ansible playbooks. The Ansible inventory is generated
8 dynamically from the Terraform state file.
10 ## Local Host Configuration
12 To perform this installation, you will need a localhost to run Terraform/Ansible (laptop, VM, etc) and an account with Equinix Metal.
13 In this example, we're using an m1.large CentOS 7 OpenStack VM as the localhost to kickoff the Kubernetes installation.
14 You'll need Ansible, Git, and PIP.
17 sudo yum install epel-release
18 sudo yum install ansible
20 sudo yum install python-pip
25 An SSH key is needed by Kubespray/Ansible to run the playbooks.
26 This key is installed into the bare metal hosts during the Terraform deployment.
27 You can generate a key new key or use an existing one.
30 ssh-keygen -f ~/.ssh/id_rsa
35 Terraform is required to deploy the bare metal infrastructure. The steps below are for installing on CentOS 7.
36 [More terraform installation options are available.](https://learn.hashicorp.com/terraform/getting-started/install.html)
38 Grab the latest version of Terraform and install it.
41 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"
42 sudo yum install unzip
43 sudo unzip terraform_0.14.10_linux_amd64.zip -d /usr/local/bin/
48 Pull over Kubespray and setup any required libraries.
51 git clone https://github.com/kubernetes-sigs/kubespray
57 Install Ansible according to [Ansible installation guide](/docs/ansible.md#installing-ansible)
61 In this example, a new cluster called "alpha" will be created.
64 cp -LRp contrib/terraform/packet/sample-inventory inventory/alpha
66 ln -s ../../contrib/terraform/packet/hosts
69 Details about the cluster, such as the name, as well as the authentication tokens and project ID
70 for Equinix Metal need to be defined. To find these values see [Equinix Metal API Accounts](https://metal.equinix.com/developers/docs/accounts/).
76 * cluster_name = alpha
77 * packet_project_id = ABCDEFGHIJKLMNOPQRSTUVWXYZ123456
78 * public_key_path = 12345678-90AB-CDEF-GHIJ-KLMNOPQRSTUV
80 ## Deploy Bare Metal Hosts
82 Initializing Terraform will pull down any necessary plugins/providers.
85 terraform init ../../contrib/terraform/packet/
88 Run Terraform to deploy the hardware.
91 terraform apply -var-file=cluster.tfvars ../../contrib/terraform/packet
94 ## Run Kubespray Playbooks
96 With the bare metal infrastructure deployed, Kubespray can now install Kubernetes and setup the cluster.
99 ansible-playbook --become -i inventory/alpha/hosts cluster.yml