Skip to content

Instantly share code, notes, and snippets.

@philmtd
Last active August 27, 2019 13:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philmtd/b78b343c65f706c1d2bf0b6386707a01 to your computer and use it in GitHub Desktop.
Save philmtd/b78b343c65f706c1d2bf0b6386707a01 to your computer and use it in GitHub Desktop.
O-Neko Kubernetes
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: o-neko-clusterrolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: o-neko
namespace: kube-system
apiVersion: v1
kind: ConfigMap
metadata:
name: o-neko-config
data:
application.yaml: |-
spring:
data:
mongodb:
uri: mongodb://o-neko-mongodb:27017/o-neko?
logging:
path: logs
o-neko:
security:
credentialsCoderKey: VJxDYI6zT9gLLfY9MyDGf2nxQ8mY7DcECxTDqKIV # change this to a random string for production
kubernetes:
auth:
token: <KUBERNETES_API_TOKEN>
server:
url: <KUBERNETES_CLUSTER_URL>
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
o-neko: o-neko
name: o-neko
spec:
replicas: 1
selector:
matchLabels:
o-neko: o-neko
minReadySeconds: 5
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
revisionHistoryLimit: 10
template:
metadata:
labels:
o-neko: o-neko
spec:
containers:
- name: o-neko
image: subshellgmbh/o-neko:latest
ports:
- containerPort: 8080
volumeMounts:
- name: config
mountPath: "/config"
livenessProbe:
httpGet:
path: /actuator/health
port: 8080
initialDelaySeconds: 15
periodSeconds: 60
timeoutSeconds: 10
readinessProbe:
httpGet:
path: /actuator/health
port: 8080
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 5
restartPolicy: Always
volumes:
- name: config
configMap:
name: o-neko-config
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: o-neko-ingress
spec:
rules:
- host: <YOUR_HOST_NAME>
http:
paths:
- path: /
backend:
serviceName: o-neko
servicePort: 8080
apiVersion: v1
kind: Service
metadata:
labels:
name: o-neko-mongodb
name: o-neko-mongodb
spec:
ports:
- port: 27017
targetPort: 27017
clusterIP: None
selector:
o-neko: mongodb
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: o-neko-mongodb-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
o-neko: mongodb
name: o-neko-mongodb
spec:
replicas: 1
template:
metadata:
labels:
o-neko: mongodb
spec:
terminationGracePeriodSeconds: 10
containers:
- name: o-neko-mongodb
image: mongo:3
ports:
- containerPort: 27017
volumeMounts:
- mountPath: /data/db
name: mongodb-volume
volumes:
- name: mongodb-volume
persistentVolumeClaim:
claimName: o-neko-mongodb-pvc
apiVersion: v1
kind: Service
metadata:
labels:
name: o-neko
name: o-neko
spec:
selector:
o-neko: o-neko
ports:
- port: 8080
targetPort: 8080
# Use the token for this service account to authenticate o-neko against the k8s cluster. Find the token with:
# kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep o-neko | awk '{print $1}')
apiVersion: v1
kind: ServiceAccount
metadata:
name: o-neko
namespace: kube-system
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment