-
Notifications
You must be signed in to change notification settings - Fork 811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cluster creation Quickstart. #122
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,210 @@ | ||
# Install and configure Agones on Kubernetes | ||
|
||
In this quickstart, we will create a Kubernetes cluster, and populate it with the resource types that power Agones. | ||
|
||
# Table of contents | ||
|
||
1. [Setting up a Google Kubernetes Engine (GKE) cluster](#setting-up-a-google-kubernetes-engine-gke-cluster) | ||
1. [Before you begin](#before-you-begin) | ||
1. [Choosing a shell](#choosing-a-shell) | ||
1. [Cloud shell](#cloud-shell) | ||
1. [Local shell](#local-shell) | ||
1. [Creating the cluster](#creating-the-cluster) | ||
1. [Creating the firewall](#creating-the-firewall) | ||
1. [Setting up a Minikube cluster](#setting-up-a-minikube-cluster) | ||
1. [Installing Minikube](#installing-minikube) | ||
1. [Creating an agones profile](#creating-an-agones-profile) | ||
1. [Starting Minikube](#starting-minikube) | ||
1. [Enabling creation of RBAC resources](#enabling-creation-of-rbac-resources) | ||
1. [Installing Agones](#installing-agones) | ||
1. [Confirming Agones started successfully](#confirming-agones-started-successfully) | ||
1. [What's next](#whats-next) | ||
|
||
# Setting up a Google Kubernetes Engine (GKE) cluster | ||
|
||
Follow these steps to create a cluster and install Agones directly on Google Kubernetes Engine (GKE). | ||
|
||
## Before you begin | ||
|
||
Take the following steps to enable the Kubernetes Engine API: | ||
|
||
1. Visit the [Kubernetes Engine][kubernetes] page in the Google Cloud Platform Console. | ||
1. Create or select a project. | ||
1. Wait for the API and related services to be enabled. This can take several minutes. | ||
1. [Enable billing][billing] for your project. | ||
* If you are not an existing GCP user, you may be able to enroll for a $300 US [Free Trial][trial] credit. | ||
|
||
[kubernetes]: https://pantheon.corp.google.com/kubernetes/list | ||
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing | ||
[trial]: https://cloud.google.com/free/ | ||
|
||
## Choosing a shell | ||
|
||
To complete this quickstart, we can use either [Google Cloud Shell][cloud-shell] or a local shell. | ||
|
||
Google Cloud Shell is a shell environment for managing resources hosted on Google Cloud Platform (GCP). Cloud Shell comes preinstalled with the [gcloud][gcloud] and [kubectl][kubectl] command-line tools. `gcloud` provides the primary command-line interface for GCP, and `kubectl` provides the command-line interface for running commands against Kubernetes clusters. | ||
|
||
If you prefer using your local shell, you must install the gcloud and kubectl command-line tools in your environment. | ||
|
||
[cloud-shell]: https://cloud.google.com/shell/ | ||
[gcloud]: https://cloud.google.com/sdk/gcloud/ | ||
[kubectl]: https://kubernetes.io/docs/user-guide/kubectl-overview/ | ||
|
||
### Cloud shell | ||
|
||
To launch Cloud Shell, perform the following steps: | ||
|
||
1. Go to [Google Cloud Platform Console][cloud] | ||
1. From the top-right corner of the console, click the **Activate Google Cloud Shell** button: ![cloud shell](/docs/cloud-shell.png?raw=true) | ||
1. A Cloud Shell session opens inside a frame at the bottom of the console. Use this shell to run `gcloud` and `kubectl` commands. | ||
1. Set a compute zone in your geographical region with the following command. The compute zone will be something like `us-west1-a`. A full list can be found [here][zones]. | ||
```bash | ||
gcloud config set compute/zone [COMPUTE_ZONE] | ||
``` | ||
|
||
[cloud]: https://console.cloud.google.com/home/dashboard | ||
[zones]: https://cloud.google.com/compute/docs/regions-zones/#available | ||
|
||
### Local shell | ||
|
||
To install `gcloud` and `kubectl`, perform the following steps: | ||
|
||
1. [Install the Google Cloud SDK][gcloud-install], which includes the `gcloud` command-line tool. | ||
1. Initialize some default configuration by running the following command. | ||
* When asked `Do you want to configure a default Compute Region and Zone? (Y/n)?`, enter `Y` and choose a zone in your geographical region of choice. | ||
```bash | ||
gcloud init | ||
``` | ||
1. Install the `kubectl` command-line tool by running the following command: | ||
```bash | ||
gcloud components install kubectl | ||
``` | ||
|
||
[gcloud-install]: https://cloud.google.com/sdk/docs/quickstarts | ||
|
||
## Creating the cluster | ||
|
||
A [cluster][cluster] consists of at least one *cluster master* machine and multiple worker machines called *nodes*: [Compute Engine virtual machine][vms] instances that run the Kubernetes processes necessary to make them part of the cluster. | ||
|
||
```bash | ||
gcloud container clusters create [CLUSTER_NAME] --cluster-version=1.9.2-gke.1 \ | ||
--no-enable-legacy-authorization \ | ||
--tags=game-server \ | ||
--enable-basic-auth \ | ||
--password=supersecretpassword \ | ||
--scopes=https://www.googleapis.com/auth/devstorage.read_only,compute-rw,cloud-platform | ||
--num-nodes=3 | ||
--machine-type=n1-standard-1 | ||
``` | ||
|
||
Flag explanations: | ||
|
||
* cluster-version: Agones requires Kubernetes version 1.9+. Once the default version reaches 1.9, this will no longer be necessary. | ||
* no-enable-legacy-authorization: This enables RBAC, the authorization scheme used by Agones to control access to resources. | ||
* tags: Defines the tags that will be attached to new nodes in the cluster. This is to grant access through ports via the firewall created in the next step. | ||
* enable-basic-auth/password: Sets the master auth scheme for interacting with the cluster. | ||
* scopes: Defines the Oauth scopes required by the nodes. | ||
* num-nodes: The number of nodes to be created in each of the cluster's zones. Default: 3 | ||
* machine-type: The type of machine to use for nodes. Default: n1-standard-1. | ||
|
||
Finally, let's tell `gcloud` that we are speaking with this cluster, and get auth credentials for `kubectl` to use. | ||
|
||
```bash | ||
gcloud config set container/cluster [CLUSTER_NAME] | ||
gcloud container clusters get-credentials [CLUSTER_NAME] | ||
``` | ||
|
||
[cluster]: https://cloud.google.com/kubernetes-engine/docs/concepts/cluster-architecture | ||
[vms]: https://cloud.google.com/compute/docs/instances/ | ||
|
||
### Creating the firewall | ||
|
||
We need a firewall to allow UDP traffic to nodes tagged as `game-server` via ports 7000-8000. | ||
|
||
```bash | ||
gcloud compute firewall-rules create game-server-firewall \ | ||
--allow udp:7000-8000 \ | ||
--target-tags game-server \ | ||
--description "Firewall to allow game server udp traffic" | ||
``` | ||
|
||
Continue to [Enabling creation of RBAC resources](#enabling-creation-of-rbac-resources) | ||
|
||
# Setting up a Minikube cluster | ||
|
||
This will setup a [Minikube](https://github.com/kubernetes/minikube) cluster, running on an `agones` profile. | ||
|
||
## Installing Minikube | ||
|
||
First, [install Minikube][minikube], which may also require you to install | ||
a virtualisation solution, such as [VirtualBox][vb] as well. | ||
|
||
[minikube]: https://github.com/kubernetes/minikube#installation | ||
[vb]: https://www.virtualbox.org | ||
|
||
## Creating an `agones` profile | ||
|
||
Let's use a minikube profile for `agones`. | ||
|
||
```bash | ||
minikube profile agones | ||
``` | ||
|
||
## Starting Minikube | ||
|
||
The following command starts a local minikube cluster via virtualbox. | ||
|
||
```bash | ||
minikube start --kubernetes-version v1.9.0 --vm-driver virtualbox \ | ||
--extra-config=apiserver.Admission.PluginNames=NamespaceLifecycle,LimitRanger,ServiceAccount,PersistentVolumeLabel,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota \ | ||
--extra-config=apiserver.Authorization.Mode=RBAC | ||
``` | ||
|
||
# Enabling creation of RBAC resources | ||
|
||
To install Agones, a service account needs permission to create some special RBAC resource types. | ||
|
||
```bash | ||
# Kubernetes Engine | ||
kubectl create clusterrolebinding cluster-admin-binding \ | ||
--clusterrole cluster-admin --user `gcloud config get-value account` | ||
# Minikube | ||
kubectl create clusterrolebinding cluster-admin-binding \ | ||
--clusterrole=cluster-admin --serviceaccount=kube-system:default | ||
``` | ||
|
||
# Installing Agones | ||
|
||
Finally, we install Agones to the cluster. | ||
|
||
```bash | ||
kubectl apply -f https://raw.githubusercontent.com/googlecloudplatform/agones/release-0.1/install.yaml | ||
``` | ||
|
||
## Confirming Agones started successfully | ||
|
||
To confirm Agones is up and running, run the following command: | ||
|
||
```bash | ||
kubectl describe --namespace agones-system pods | ||
``` | ||
|
||
It should describe the single pod created in the `agones-system` namespace, with no error messages or status. The `Conditions` section should look like this: | ||
|
||
``` | ||
Conditions: | ||
Type Status | ||
Initialized True | ||
Ready True | ||
PodScheduled True | ||
``` | ||
|
||
That's it! This creates the [Custom Resource Definitions][crds] that power Agones and allows us to define resources of type `GameServer`. | ||
|
||
[crds]: https://kubernetes.io/docs/concepts/api-extension/custom-resources/ | ||
|
||
# What's next | ||
|
||
* Go through the [Create a Game Server Quickstart][quickstart] | ||
|
||
[quickstart]: /docs/create_gameserver.md |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stealing from the istio docs, shall we add:
Just so that it's clear you can use the free trial 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done :)