Skip to main content

Setup Kubernetes

Now that all your services are created and containerized, it's time to put everything together! Open Match is a project created to work in a Kubernetes ecosystem. This part of the tutorial will show you a basic kubernetes configuration.

Prerequisites#


Don't forget that Open Match core MUST be installed before this step.

Create YAML file#

Using Local images (No repository)#

Kubernetes support YAML configuration file. You will have to create a file named basics.yaml. In this file, we will put all the configuration for our custom Open Match.

# Front End Component
apiVersion: apps/v1
kind: Deployment
metadata:
name: basics-front-end
namespace: open-match
labels:
app: basics-front-end
component: frontend
spec:
replicas: 1
selector:
matchLabels:
app: basics-front-end
component: frontend
template:
metadata:
labels:
app: basics-front-end
component: frontend
spec:
containers:
- name: basics-front-end
image: edgegap-om-tuto-frontend:tuto
---
kind: Service
apiVersion: v1
metadata:
name: basics-front-end
namespace: open-match
spec:
type: LoadBalancer
selector:
app: basics-front-end
component: frontend
type: LoadBalancer
ports:
- port: 51504
targetPort: 51504
---
# Match Function component
apiVersion: apps/v1
kind: Deployment
metadata:
name: basics-match-function
namespace: open-match
labels:
app: basics-match-function
component: matchfunction
spec:
replicas: 1
selector:
matchLabels:
app: basics-match-function
component: matchfunction
template:
metadata:
labels:
app: basics-match-function
component: matchfunction
spec:
containers:
- name: basics-match-function
image: edgegap-om-tuto-match-function:tuto
---
kind: Service
apiVersion: v1
metadata:
name: basics-match-function
namespace: open-match
labels:
app: basics-match-function
component: matchfunction
spec:
selector:
app: basics-match-function
component: matchfunction
type: ClusterIP
ports:
- name: grpc
protocol: TCP
port: 50502
targetPort: 50502
---
# Director component
apiVersion: apps/v1
kind: Deployment
metadata:
name: basics-director
namespace: open-match
labels:
app: basics-director
spec:
replicas: 1
selector:
matchLabels:
app: basics-director
template:
metadata:
labels:
app: basics-director
spec:
containers:
- name: basics-director
image: edgegap-om-tuto-director:tuto
Warning : Keep in mind that this configuration is not meant to be used in production!

Using Edgegap's Harbor (Private repository)#

Kubernetes support YAML configuration file. You will have to create a file named basics.yaml. In this file, we will put all the configuration for our custom Open Match.

In this file, copy and paste the following configuration. Don't forget to change <PROJECT_NAME> by your project name in Edgegap's Harbor.

Edgegap's Harbor is private, we need to create credentials that Kubernetes will use to pull all the images. Replace <USENAME> by your username and <PWORD> by your password. (If you are using a robot, change <USENAME> by your robot's name and <PWORD> by your robot's token)

kubectl --namespace open-match create secret docker-registry edgegapopenmatchbasics --docker-server=harbor.edgegap.net --docker-username=<USENAME> --docker-password=<PWORD>
# Front End Component
apiVersion: apps/v1
kind: Deployment
metadata:
name: basics-front-end
namespace: open-match
labels:
app: basics-front-end
component: frontend
spec:
replicas: 1
selector:
matchLabels:
app: basics-front-end
component: frontend
template:
metadata:
labels:
app: basics-front-end
component: frontend
spec:
imagePullSecrets:
- name: edgegapopenmatchbasics
containers:
- name: basics-front-end
imagePullPolicy: Always
image: harbor.edgegap.net/<PROJECT_NAME>/edgegap-om-tuto-frontend:tuto
---
kind: Service
apiVersion: v1
metadata:
name: basics-front-end
namespace: open-match
spec:
type: LoadBalancer
selector:
app: basics-front-end
component: frontend
type: LoadBalancer
ports:
- port: 51504
targetPort: 51504
---
# Match Function component
apiVersion: apps/v1
kind: Deployment
metadata:
name: basics-match-function
namespace: open-match
labels:
app: basics-match-function
component: matchfunction
spec:
replicas: 1
selector:
matchLabels:
app: basics-match-function
component: matchfunction
template:
metadata:
labels:
app: basics-match-function
component: matchfunction
spec:
imagePullSecrets:
- name: edgegapopenmatchbasics
containers:
- name: basics-match-function
imagePullPolicy: Always
image: harbor.edgegap.net/<PROJECT_NAME>/edgegap-om-tuto-match-function:tuto
---
kind: Service
apiVersion: v1
metadata:
name: basics-match-function
namespace: open-match
labels:
app: basics-match-function
component: matchfunction
spec:
selector:
app: basics-match-function
component: matchfunction
type: ClusterIP
ports:
- name: grpc
protocol: TCP
port: 50502
targetPort: 50502
---
# Director component
apiVersion: apps/v1
kind: Deployment
metadata:
name: basics-director
namespace: open-match
labels:
app: basics-director
spec:
replicas: 1
selector:
matchLabels:
app: basics-director
template:
metadata:
labels:
app: basics-director
spec:
imagePullSecrets:
- name: edgegapopenmatchbasics
containers:
- name: basics-director
imagePullPolicy: Always
image: harbor.edgegap.net/<PROJECT_NAME>/edgegap-om-tuto-director:tuto
Warning : Keep in mind that this configuration is not meant to be used in production!

Using public repository#

Kubernetes support YAML configuration file. You will have to create a file named basics.yaml. In this file, we will put all the configuration for our custom Open Match.

In this file, copy and paste the following configuration. Don't forget to change <REPOSITORY_MAME> by your container's repository.

# Front End Component
apiVersion: apps/v1
kind: Deployment
metadata:
name: basics-front-end
namespace: open-match
labels:
app: basics-front-end
component: frontend
spec:
replicas: 1
selector:
matchLabels:
app: basics-front-end
component: frontend
template:
metadata:
labels:
app: basics-front-end
component: frontend
spec:
containers:
- name: basics-front-end
imagePullPolicy: Always
image: <REPOSITORY_MAME>/edgegap-om-tuto-frontend:tuto
---
kind: Service
apiVersion: v1
metadata:
name: basics-front-end
namespace: open-match
spec:
type: LoadBalancer
selector:
app: basics-front-end
component: frontend
type: LoadBalancer
ports:
- port: 51504
targetPort: 51504
---
# Match Function component
apiVersion: apps/v1
kind: Deployment
metadata:
name: basics-match-function
namespace: open-match
labels:
app: basics-match-function
component: matchfunction
spec:
replicas: 1
selector:
matchLabels:
app: basics-match-function
component: matchfunction
template:
metadata:
labels:
app: basics-match-function
component: matchfunction
spec:
containers:
- name: basics-match-function
imagePullPolicy: Always
image: <REPOSITORY_MAME>/edgegap-om-tuto-match-function:tuto
---
kind: Service
apiVersion: v1
metadata:
name: basics-match-function
namespace: open-match
labels:
app: basics-match-function
component: matchfunction
spec:
selector:
app: basics-match-function
component: matchfunction
type: ClusterIP
ports:
- name: grpc
protocol: TCP
port: 50502
targetPort: 50502
---
# Director component
apiVersion: apps/v1
kind: Deployment
metadata:
name: basics-director
namespace: open-match
labels:
app: basics-director
spec:
replicas: 1
selector:
matchLabels:
app: basics-director
template:
metadata:
labels:
app: basics-director
spec:
containers:
- name: basics-director
imagePullPolicy: Always
image: <REPOSITORY_MAME>/edgegap-om-tuto-director:tuto
Warning : Keep in mind that this configuration is not meant to be used in production!

Apply#

It's time to apply your configuration. In your Kubernetes host system, run this command.

kubectl apply -f ./basics.yaml
Notes : If you used Edgegap's Harbor, don't forget to delete your credentials. You can use this command.
kubectl --namespace open-match delete secret edgegapopenmatchbasics

Delete#

If you need to delete the configuration, just run this command.

kubectl delete -f ./basics.yaml