first commit
This commit is contained in:
8
01-namespace.yaml
Normal file
8
01-namespace.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
annotations:
|
||||
labels:
|
||||
kubernetes.io/metadata.name: minecraft
|
||||
name: minecraft
|
||||
---
|
||||
15
02-pvc.yaml
Normal file
15
02-pvc.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
annotations:
|
||||
name: minecraft-data
|
||||
namespace: minecraft
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 100Gi
|
||||
volumeMode: Filesystem
|
||||
storageClassName: ocs-storagecluster-cephfs
|
||||
---
|
||||
106
03-deployment.yaml
Normal file
106
03-deployment.yaml
Normal file
@@ -0,0 +1,106 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
annotations:
|
||||
labels:
|
||||
app: minecraft
|
||||
app.kubernetes.io/component: minecraft
|
||||
app.kubernetes.io/instance: minecraft
|
||||
name: minecraft
|
||||
namespace: minecraft
|
||||
spec:
|
||||
progressDeadlineSeconds: 600
|
||||
replicas: 1
|
||||
revisionHistoryLimit: 10
|
||||
selector:
|
||||
matchLabels:
|
||||
deployment: minecraft
|
||||
strategy:
|
||||
rollingUpdate:
|
||||
maxSurge: 25%
|
||||
maxUnavailable: 25%
|
||||
type: RollingUpdate
|
||||
template:
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
deployment: minecraft
|
||||
spec:
|
||||
containers:
|
||||
- env:
|
||||
- name: EULA
|
||||
value: "true"
|
||||
- name: MOTD
|
||||
value: Minecraft on Openshift
|
||||
- name: GAME_MODE
|
||||
value: creative
|
||||
- name: ONLINE_MODE
|
||||
value: "false"
|
||||
image: gitea.lab.cudanet.org/cudanet/minecraft/minecraft:1.21.11
|
||||
imagePullPolicy: IfNotPresent
|
||||
name: minecraft
|
||||
ports:
|
||||
- containerPort: 25565
|
||||
protocol: TCP
|
||||
resources: {}
|
||||
terminationMessagePath: /dev/termination-log
|
||||
terminationMessagePolicy: File
|
||||
volumeMounts:
|
||||
- mountPath: /data
|
||||
name: minecraft-data
|
||||
dnsPolicy: ClusterFirst
|
||||
restartPolicy: Always
|
||||
schedulerName: default-scheduler
|
||||
securityContext: {}
|
||||
serviceAccount: minecraft
|
||||
serviceAccountName: minecraft
|
||||
terminationGracePeriodSeconds: 30
|
||||
volumes:
|
||||
- name: minecraft-data
|
||||
persistentVolumeClaim:
|
||||
claimName: minecraft-data
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
annotations:
|
||||
labels:
|
||||
app: geysermc
|
||||
app.kubernetes.io/component: geysermc
|
||||
app.kubernetes.io/instance: geysermc
|
||||
name: geysermc
|
||||
namespace: minecraft
|
||||
spec:
|
||||
progressDeadlineSeconds: 600
|
||||
replicas: 1
|
||||
revisionHistoryLimit: 10
|
||||
selector:
|
||||
matchLabels:
|
||||
deployment: geysermc
|
||||
strategy:
|
||||
rollingUpdate:
|
||||
maxSurge: 25%
|
||||
maxUnavailable: 25%
|
||||
type: RollingUpdate
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
deployment: geysermc
|
||||
spec:
|
||||
containers:
|
||||
- image: gitea.lab.cudanet.org/cudanet/minecraft/geysermc:1.21.11
|
||||
imagePullPolicy: IfNotPresent
|
||||
name: geysermc
|
||||
ports:
|
||||
- containerPort: 19132
|
||||
protocol: UDP
|
||||
resources: {}
|
||||
terminationMessagePath: /dev/termination-log
|
||||
terminationMessagePolicy: File
|
||||
dnsPolicy: ClusterFirst
|
||||
restartPolicy: Always
|
||||
schedulerName: default-scheduler
|
||||
securityContext: {}
|
||||
terminationGracePeriodSeconds: 30
|
||||
55
04-svc.yaml
Normal file
55
04-svc.yaml
Normal file
@@ -0,0 +1,55 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
metallb.universe.tf/ip-allocated-from-pool: prod-ocp-101-200
|
||||
metallb.universe.tf/allow-shared-ip: minecraft
|
||||
labels:
|
||||
app: minecraft
|
||||
app.kubernetes.io/component: minecraft
|
||||
app.kubernetes.io/instance: minecraft
|
||||
name: minecraft
|
||||
namespace: minecraft
|
||||
spec:
|
||||
allocateLoadBalancerNodePorts: true
|
||||
externalTrafficPolicy: Cluster
|
||||
internalTrafficPolicy: Cluster
|
||||
ipFamilies:
|
||||
- IPv4
|
||||
ipFamilyPolicy: SingleStack
|
||||
ports:
|
||||
- port: 25565
|
||||
protocol: TCP
|
||||
targetPort: 25565
|
||||
selector:
|
||||
deployment: minecraft
|
||||
sessionAffinity: None
|
||||
type: LoadBalancer
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
metallb.universe.tf/allow-shared-ip: minecraft
|
||||
metallb.universe.tf/ip-allocated-from-pool: prod-ocp-101-200
|
||||
labels:
|
||||
app: geysermc
|
||||
app.kubernetes.io/component: geysermc
|
||||
app.kubernetes.io/instance: geysermc
|
||||
name: geysermc
|
||||
namespace: minecraft
|
||||
spec:
|
||||
allocateLoadBalancerNodePorts: true
|
||||
externalTrafficPolicy: Cluster
|
||||
internalTrafficPolicy: Cluster
|
||||
ipFamilies:
|
||||
- IPv4
|
||||
ipFamilyPolicy: SingleStack
|
||||
ports:
|
||||
- port: 19132
|
||||
protocol: UDP
|
||||
targetPort: 19132
|
||||
selector:
|
||||
deployment: geysermc
|
||||
sessionAffinity: None
|
||||
type: LoadBalancer
|
||||
8
05-sa.yaml
Normal file
8
05-sa.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: minecraft
|
||||
namespace: minecraft
|
||||
labels:
|
||||
app: minecraft
|
||||
---
|
||||
16
06-clusterrole.yaml
Normal file
16
06-clusterrole.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: minecraft-anyuid
|
||||
labels:
|
||||
app: minecraft
|
||||
rules:
|
||||
- apiGroups:
|
||||
- security.openshift.io
|
||||
resourceNames:
|
||||
- anyuid
|
||||
resources:
|
||||
- securitycontextconstraints
|
||||
verbs:
|
||||
- use
|
||||
---
|
||||
12
07-clusterrolebinding.yaml
Normal file
12
07-clusterrolebinding.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: minecraft-anyuid
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: system:openshift:scc:anyuid
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: minecraft
|
||||
namespace: minecraft
|
||||
34
README.md
Normal file
34
README.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# minecraft
|
||||
|
||||
```
|
||||
YAML=$(ls | grep yaml | sort)
|
||||
for y in $YAML; do oc apply -f $y; done
|
||||
```
|
||||
|
||||
# UPDATE 8/30/2023:
|
||||
|
||||
new ServiceAccount, ClusterRole and ClusterRoleBinding created, now it doesn't rely on having to manually add an scc to the SA post deployment. Much cleaner and easier to manage.
|
||||
|
||||
Then in order to restore the backup of the 'pirate ship' server, you need to do some trickery. You'll need to let the generic server come up, then you need copy the file 'minecraft.tar.gz' to the debug pod, erase the contents of /data, extract the tarball into /data, fix permissions and then bounce the pod.
|
||||
|
||||
```
|
||||
oc get pod
|
||||
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
minecraft-7cdb5fc967-mjchg 1/1 Running 0 2m39s
|
||||
|
||||
oc debug minecraft-7cdb5fc967-mjchg
|
||||
# from within the debug pod
|
||||
# rm -rfv /data/*
|
||||
|
||||
oc cp minecraft.tar.gz minecraft-7cdb5fc967-mjchg:/data/
|
||||
|
||||
# from within the debug pod
|
||||
# tar xf minecraft.tar.gz
|
||||
# chown -vR minecraft:minecraft /data
|
||||
# chmod -vR 777 /data
|
||||
# exit
|
||||
|
||||
oc delete pod minecraft-7cdb5fc967-mjchg
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user