Creating a config

This page explains how to register, list, and view details of a Game Servers config in a deployment.

Before you begin

Before you start, we recommend you familiarize yourself with key concepts in the Game Servers Overview. Make sure you have also performed the following tasks:

Set up default gcloud settings using one of the following methods:

  • Using gcloud init, if you want to be walked through setting defaults.
  • Using gcloud config, to individually set your project ID.

Using gcloud init

  1. Run gcloud init and follow the directions:

    gcloud init

    If you are using SSH on a remote server, use the --console-only flag to prevent the command from launching a browser:

    gcloud init --console-only
  2. Follow the instructions to authorize gcloud to use your Google Cloud account.
  3. Create a new configuration or select an existing one.
  4. Choose a Google Cloud project.
  5. Choose a default Compute Engine zone.

Using gcloud config

  • Set your default project ID:
    gcloud config set project [PROJECT_ID]
  • Update gcloud to the latest version:
    gcloud components update

Creating a config

Make sure you have created a Game Servers deployment.

You can create a Game Servers config in a deployment using the gcloud command-line tool.

To create a game server config:

  1. Copy this fleet specification into a file.

    - name: fleet-spec-1
      fleetSpec:
       replicas: 10
       scheduling: Packed
       strategy:
         type: RollingUpdate
         rollingUpdate:
           maxSurge: 25%
           maxUnavailable: 25%
       template:
         metadata:
           labels:
             gameName: udp-server
         spec:
           ports:
           - name: default
             portPolicy: Dynamic
             containerPort: 2156
             protocol: TCP
           health:
             initialDelaySeconds: 30
             periodSeconds: 60
           sdkServer:
             logLevel: Info
             grpcPort: 9357
             httpPort: 9358
           template:
             spec:
               containers:
               - name: dedicated
                 image: gcr.io/agones-images/udp-server:0.17
                 imagePullPolicy: Always
                 resources:
                   requests:
                     memory: 200Mi
                     cpu: 500m
                   limits:
                     memory: 200Mi
                     cpu: 500m
    
  2. Run the following command and replace the placeholder values, such as deploymentID and configID, with appropriate values:

    gcloud beta game servers configs create configID --deployment deploymentID --fleet-configs-file fleetSpecFile
    

    The variable placeholders correspond to the following descriptions:

  • configID is a unique identifier that you can specify for this config.
  • deploymentID is the unique identifier for the deployment.
  • fleetSpecFile is the path to the file with the Agones Fleet specification.

Listing configs

You can list configs using the gcloud command-line tool.

To list all configs, run the following command:

gcloud beta game servers configs list

To list all configs in a deployment, run the following command and replace deploymentID with the parent deployment that you want to list the configs in:

gcloud beta game servers configs list --deployment=deploymentID

Viewing details about a config

You can find details about a config, such as the creation time, using the gcloud command-line tool:

To view the details of a config, run the following command and replace the placeholder values, such as deploymentID and configID, with appropriate values:

gcloud beta game servers configs describe configID --deployment deploymentID

The output gives you the details of the config.

The variable placeholders correspond to the following descriptions:

  • configID is the unique identifier that you specified for this game server config.
  • deploymentID is a unique identifier for the parent deployment.

What's next