Skip to content
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

fix: added basic yamls for kubernetes support. #65

Merged
merged 2 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions k8s/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: palworld-cm
data:
PUID: "1000"
PGID: "1000"
PORT: "8211" # Optional but recommended
PLAYERS: "16" # Optional but recommended
MULTITHREADING: "true"
RCON_ENABLED: "true"
RCON_PORT: "25575"
COMMUNITY: "false" # Enable this if you want your server to show up in the community servers tab, USE WITH SERVER_PASSWORD!
# Enable the environment variables below if you have COMMUNITY=true
# SERVER_PASSWORD: "yourServerPassword"
SERVER_NAME: "Server_Name" # Note, it seems spaces are not supported, so use underlines.
43 changes: 43 additions & 0 deletions k8s/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: palworld-server
name: palworld-server
spec:
replicas: 1
selector:
matchLabels:
app: palworld-server
template:
metadata:
labels:
app: palworld-server
spec:
containers:
- name: palworld-server
image: thijsvanloef/palworld-server-docker
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8211
name: 8211-palworld
protocol: UDP
- containerPort: 27015
name: 27015-palworld
protocol: UDP
env:
- name: ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: palworld-secrets
key: rconPassword
envFrom:
- configMapRef:
name: palworld-cm
volumeMounts:
- mountPath: /palworld
name: datadir
volumes:
- name: datadir
persistentVolumeClaim:
claimName: palworld-server-datadir
12 changes: 12 additions & 0 deletions k8s/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app: palworld-server
name: palworld-server-datadir
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
7 changes: 7 additions & 0 deletions k8s/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Setup Palworld in kubernetes

kubectl apply -f pvc.yaml
kubectl apply -f configmap.yaml
kubectl apply -f secret.yaml
kubectl apply -f service.yaml
kubectl apply -f deployment.yaml
7 changes: 7 additions & 0 deletions k8s/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: palworld-secrets
type: Opaque
stringData:
rconPassword: yourRconPassword

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"yourRconPassword in base64 format" ?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's plaintext in the manifest files. It's base64 if you kubectl describe though.

I usually call it something like example.secret.yaml, make a copy, put the actual password in, apply the yaml with kubectl apply -f secrets.yaml then rm secrets.yaml.

19 changes: 19 additions & 0 deletions k8s/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: palworld-server
name: palworld-server
spec:
ports:
- name: 8211-palworld
port: 8211
protocol: UDP
targetPort: 8211-palworld
- name: 27015-palworld
port: 27015
protocol: UDP
targetPort: 27015-palworld
selector:
app: palworld-server
type: LoadBalancer
Loading