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#

Create YAML file#

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
- name: http
protocol: TCP
port: 51502
targetPort: 51502
---
# 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!

Apply#

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

kubectl apply -f ./basics.yaml

Delete#

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

kubectl delete -f ./basics.yaml