Prerequisites:
- A GCP project which can be created here
- An authorized gcloud which can be downloaded here
- docker-engine which can be downloaded here
Clone the kubernetes-anywhere repository.
$ git clone https://github.com/kubernetes/kubernetes-anywhere.git
$ cd kubernetes-anywhere
Setup a GCP service account for kubernetes-anywhere to use to deploy your cluster. First export the name of your project.
$ export PROJECT_ID="<replace with the name of your project>"
then run:
$ export SERVICE_ACCOUNT="kubernetes-anywhere@${PROJECT_ID}.iam.gserviceaccount.com"
$ gcloud iam service-accounts create kubernetes-anywhere \
--display-name kubernetes-anywhere
$ gcloud iam service-accounts keys create phase1/gce/account.json \
--iam-account "${SERVICE_ACCOUNT}"
$ gcloud projects add-iam-policy-binding "${PROJECT_ID}" \
--member "serviceAccount:${SERVICE_ACCOUNT}" --role roles/editor
Now hop into your deployment shell with all the tools you need to deploy a kubernetes-anywhere cluster. Run:
$ make docker-dev
You will be logged into your dev shell:
If kubeadm
is the phase2.provider, then login to gcloud by calling:
$ gcloud auth login
then run:
$ make deploy
and fill complete the config wizard to deploy a kubernetes-anywhere cluster. Eventually, you will see a set of nodes when you run:
$ kubectl --kubeconfig $(make -s kubeconfig-path) get nodes
It may take a couple minutes for the Kubernetes API to start responding to requests.
After you've had a great experience with Kubernetes, run:
$ make destroy
to tear down your cluster.