parent
38b3aaac83
commit
af1b38f37a
@ -0,0 +1,32 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: hello
|
||||||
|
spec:
|
||||||
|
replicas: 2
|
||||||
|
strategy:
|
||||||
|
type: RollingUpdate
|
||||||
|
rollingUpdate:
|
||||||
|
maxUnavailable: 100%
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: hello
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: hello
|
||||||
|
spec:
|
||||||
|
affinity:
|
||||||
|
# ⬇⬇⬇ This ensures pods will land on separate hosts
|
||||||
|
podAntiAffinity:
|
||||||
|
requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- labelSelector:
|
||||||
|
matchExpressions: [{ key: app, operator: In, values: [hello] }]
|
||||||
|
topologyKey: "kubernetes.io/hostname"
|
||||||
|
containers:
|
||||||
|
- name: hello-from
|
||||||
|
image: pbitty/hello-from:latest
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
containerPort: 80
|
||||||
|
terminationGracePeriodSeconds: 1
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
secretGenerator:
|
||||||
|
- name: mysql-pass
|
||||||
|
literals:
|
||||||
|
- password=YOUR_PASSWORD
|
||||||
|
resources:
|
||||||
|
- mysql-deployment.yaml
|
||||||
|
- wordpress-deployment.yaml
|
||||||
@ -0,0 +1,66 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: wordpress-mysql
|
||||||
|
labels:
|
||||||
|
app: wordpress
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 3306
|
||||||
|
targetPort: 5432
|
||||||
|
selector:
|
||||||
|
app: wordpress
|
||||||
|
tier: mysql
|
||||||
|
clusterIP: None
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: mysql-pv-claim
|
||||||
|
labels:
|
||||||
|
app: wordpress
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 2Gi
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: wordpress-mysql
|
||||||
|
labels:
|
||||||
|
app: wordpress
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: wordpress
|
||||||
|
tier: mysql
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: wordpress
|
||||||
|
tier: mysql
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- image: postgres:15.1
|
||||||
|
name: mysql
|
||||||
|
env:
|
||||||
|
- name: MYSQL_ROOT_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: mysql-pass
|
||||||
|
key: password
|
||||||
|
ports:
|
||||||
|
- containerPort: 3306
|
||||||
|
name: mysql
|
||||||
|
volumeMounts:
|
||||||
|
- name: mysql-persistent-storage
|
||||||
|
mountPath: /var/lib/mysql
|
||||||
|
volumes:
|
||||||
|
- name: mysql-persistent-storage
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: mysql-pv-claim
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: wordpress
|
||||||
|
labels:
|
||||||
|
app: wordpress
|
||||||
|
spec:
|
||||||
|
type: NodePort
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
nodePort: 30007
|
||||||
|
selector:
|
||||||
|
app: wordpress
|
||||||
|
tier: frontend
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: wp-pv-claim
|
||||||
|
labels:
|
||||||
|
app: wordpress
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 2Gi
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: wordpress
|
||||||
|
labels:
|
||||||
|
app: wordpress
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: wordpress
|
||||||
|
tier: frontend
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: wordpress
|
||||||
|
tier: frontend
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- image: wordpress:4.8-apache
|
||||||
|
name: wordpress
|
||||||
|
env:
|
||||||
|
- name: WORDPRESS_DB_HOST
|
||||||
|
value: wordpress-mysql
|
||||||
|
- name: WORDPRESS_DB_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: mysql-pass
|
||||||
|
key: password
|
||||||
|
ports:
|
||||||
|
- containerPort: 80
|
||||||
|
name: wordpress
|
||||||
|
volumeMounts:
|
||||||
|
- name: wordpress-persistent-storage
|
||||||
|
mountPath: /var/www/html
|
||||||
|
volumes:
|
||||||
|
- name: wordpress-persistent-storage
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: wp-pv-claim
|
||||||
Binary file not shown.
@ -0,0 +1,40 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: adminer
|
||||||
|
labels:
|
||||||
|
app: adminer
|
||||||
|
spec:
|
||||||
|
type: LoadBalancer
|
||||||
|
ports:
|
||||||
|
- port: 9002
|
||||||
|
targetPort: 8080
|
||||||
|
selector:
|
||||||
|
app: adminer
|
||||||
|
tier: frontend
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: adminer
|
||||||
|
labels:
|
||||||
|
app: adminer
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: adminer
|
||||||
|
tier: frontend
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: adminer
|
||||||
|
tier: frontend
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- image: adminer
|
||||||
|
name: adminer
|
||||||
|
ports:
|
||||||
|
- containerPort: 8080
|
||||||
|
name: adminer
|
||||||
@ -0,0 +1,83 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/instance: statping
|
||||||
|
app.kubernetes.io/name: statping
|
||||||
|
app.kubernetes.io/version: v0.90.74
|
||||||
|
name: statping
|
||||||
|
namespace: default
|
||||||
|
spec:
|
||||||
|
progressDeadlineSeconds: 600
|
||||||
|
replicas: 1
|
||||||
|
revisionHistoryLimit: 3
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/instance: statping
|
||||||
|
app.kubernetes.io/name: statping
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/instance: statping
|
||||||
|
app.kubernetes.io/name: statping
|
||||||
|
spec:
|
||||||
|
automountServiceAccountToken: true
|
||||||
|
containers:
|
||||||
|
- env:
|
||||||
|
- name: DB_CONN
|
||||||
|
value: postgres
|
||||||
|
- name: DB_DATABASE
|
||||||
|
value: postgres
|
||||||
|
- name: DB_HOST
|
||||||
|
value: statping-postgresql
|
||||||
|
- name: DB_PASS
|
||||||
|
value: changeme
|
||||||
|
- name: DB_USER
|
||||||
|
value: postgres
|
||||||
|
- name: DESCRIPTION
|
||||||
|
value: This is a Statping instance deployed as Helm chart
|
||||||
|
- name: DISABLE_LOGS
|
||||||
|
value: "false"
|
||||||
|
- name: NAME
|
||||||
|
value: Statping Example
|
||||||
|
- name: POSTGRES_SSLMODE
|
||||||
|
value: disable
|
||||||
|
- name: TZ
|
||||||
|
value: UTC
|
||||||
|
- name: USE_CDN
|
||||||
|
value: "false"
|
||||||
|
- name: VIRTUAL_HOST
|
||||||
|
- name: VIRTUAL_PORT
|
||||||
|
value: "8080"
|
||||||
|
image: statping/statping:v0.90.74
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
livenessProbe:
|
||||||
|
failureThreshold: 3
|
||||||
|
periodSeconds: 10
|
||||||
|
successThreshold: 1
|
||||||
|
tcpSocket:
|
||||||
|
port: 8080
|
||||||
|
timeoutSeconds: 1
|
||||||
|
name: statping
|
||||||
|
ports:
|
||||||
|
- containerPort: 8080
|
||||||
|
name: http
|
||||||
|
protocol: TCP
|
||||||
|
readinessProbe:
|
||||||
|
failureThreshold: 3
|
||||||
|
periodSeconds: 10
|
||||||
|
successThreshold: 1
|
||||||
|
tcpSocket:
|
||||||
|
port: 8080
|
||||||
|
timeoutSeconds: 1
|
||||||
|
resources:
|
||||||
|
startupProbe:
|
||||||
|
failureThreshold: 30
|
||||||
|
periodSeconds: 5
|
||||||
|
successThreshold: 1
|
||||||
|
tcpSocket:
|
||||||
|
port: 8080
|
||||||
|
timeoutSeconds: 1
|
||||||
|
restartPolicy: Always
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: importer
|
||||||
|
data:
|
||||||
|
init.sh: |
|
||||||
|
#!/bin/bash
|
||||||
|
PGPASSWORD=YOUR_PASSWORD psql -v ON_ERROR_STOP=1 -h statping-postgres -p 5432 -U statping --dbname "statping" <<-EOSQL
|
||||||
|
TRUNCATE core;
|
||||||
|
TRUNCATE services;
|
||||||
|
COPY core FROM '/initdb/core.csv' DELIMITER ',' CSV HEADER;
|
||||||
|
COPY services FROM '/initdb/services.csv' DELIMITER ',' CSV HEADER;
|
||||||
|
EOSQL
|
||||||
|
|
@ -0,0 +1,9 @@
|
|||||||
|
secretGenerator:
|
||||||
|
- name: postgres-pass
|
||||||
|
literals:
|
||||||
|
- password=YOUR_PASSWORD
|
||||||
|
resources:
|
||||||
|
- postgres-deployment.yaml
|
||||||
|
- init-config.yaml
|
||||||
|
- statping-deployment.yaml
|
||||||
|
- adminer-deployment.yaml
|
||||||
@ -0,0 +1,72 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: statping-postgres
|
||||||
|
labels:
|
||||||
|
app: statping
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 5432
|
||||||
|
selector:
|
||||||
|
app: statping
|
||||||
|
tier: postgres
|
||||||
|
clusterIP: None
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: postgres-pv-claim
|
||||||
|
labels:
|
||||||
|
app: statping
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 2Gi
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: statping-postgres
|
||||||
|
labels:
|
||||||
|
app: statping
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: statping
|
||||||
|
tier: postgres
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: statping
|
||||||
|
tier: postgres
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- image: postgres:15.1
|
||||||
|
name: postgres
|
||||||
|
env:
|
||||||
|
- name: POSTGRES_USER
|
||||||
|
value: statping
|
||||||
|
- name: POSTGRES_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: postgres-pass
|
||||||
|
key: password
|
||||||
|
ports:
|
||||||
|
- containerPort: 5432
|
||||||
|
name: postgres
|
||||||
|
volumeMounts:
|
||||||
|
- name: postgres-persistent-storage
|
||||||
|
mountPath: /var/lib/postgresql/data
|
||||||
|
- name: host-mount
|
||||||
|
mountPath: /initdb
|
||||||
|
volumes:
|
||||||
|
- name: host-mount
|
||||||
|
hostPath:
|
||||||
|
path: /k8s/statping/initdb
|
||||||
|
- name: postgres-persistent-storage
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: postgres-pv-claim
|
||||||
@ -0,0 +1,116 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/component: primary
|
||||||
|
app.kubernetes.io/instance: statping
|
||||||
|
app.kubernetes.io/name: postgresql
|
||||||
|
name: statping-postgresql
|
||||||
|
namespace: default
|
||||||
|
spec:
|
||||||
|
podManagementPolicy: OrderedReady
|
||||||
|
replicas: 1
|
||||||
|
revisionHistoryLimit: 10
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/component: primary
|
||||||
|
app.kubernetes.io/instance: statping
|
||||||
|
app.kubernetes.io/name: postgresql
|
||||||
|
serviceName: statping-postgresql-hl
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/component: primary
|
||||||
|
app.kubernetes.io/instance: statping
|
||||||
|
app.kubernetes.io/name: postgresql
|
||||||
|
name: statping-postgresql
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- env:
|
||||||
|
- name: BITNAMI_DEBUG
|
||||||
|
value: "false"
|
||||||
|
- name: POSTGRESQL_PORT_NUMBER
|
||||||
|
value: "5432"
|
||||||
|
- name: POSTGRESQL_VOLUME_DIR
|
||||||
|
value: /bitnami/postgresql
|
||||||
|
- name: PGDATA
|
||||||
|
value: /bitnami/postgresql/data
|
||||||
|
- name: POSTGRES_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: postgres-password
|
||||||
|
name: statping-postgresql
|
||||||
|
- name: POSTGRES_DB
|
||||||
|
value: postgres
|
||||||
|
- name: POSTGRESQL_ENABLE_LDAP
|
||||||
|
value: "no"
|
||||||
|
- name: POSTGRESQL_ENABLE_TLS
|
||||||
|
value: "no"
|
||||||
|
- name: POSTGRESQL_LOG_HOSTNAME
|
||||||
|
value: "false"
|
||||||
|
- name: POSTGRESQL_LOG_CONNECTIONS
|
||||||
|
value: "false"
|
||||||
|
- name: POSTGRESQL_LOG_DISCONNECTIONS
|
||||||
|
value: "false"
|
||||||
|
- name: POSTGRESQL_PGAUDIT_LOG_CATALOG
|
||||||
|
value: "off"
|
||||||
|
- name: POSTGRESQL_CLIENT_MIN_MESSAGES
|
||||||
|
value: error
|
||||||
|
- name: POSTGRESQL_SHARED_PRELOAD_LIBRARIES
|
||||||
|
value: pgaudit
|
||||||
|
image: docker.io/bitnami/postgresql:14.4.0-debian-11-r4
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
livenessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- exec pg_isready -U "postgres" -d "dbname=postgres" -h 127.0.0.1 -p 5432
|
||||||
|
failureThreshold: 6
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
successThreshold: 1
|
||||||
|
timeoutSeconds: 5
|
||||||
|
name: postgresql
|
||||||
|
ports:
|
||||||
|
- containerPort: 5432
|
||||||
|
name: tcp-postgresqlh
|
||||||
|
protocol: TCP
|
||||||
|
readinessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- -e
|
||||||
|
- |
|
||||||
|
exec pg_isready -U "postgres" -d "dbname=postgres" -h 127.0.0.1 -p 5432
|
||||||
|
[ -f /opt/bitnami/postgresql/tmp/.initialized ] || [ -f /bitnami/postgresql/.initialized ]
|
||||||
|
failureThreshold: 6
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 10
|
||||||
|
successThreshold: 1
|
||||||
|
timeoutSeconds: 5
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /dev/shm
|
||||||
|
name: dshm
|
||||||
|
- mountPath: /bitnami/postgresql
|
||||||
|
name: data
|
||||||
|
restartPolicy: Always
|
||||||
|
volumes:
|
||||||
|
- emptyDir:
|
||||||
|
medium: Memory
|
||||||
|
name: dshm
|
||||||
|
updateStrategy:
|
||||||
|
type: RollingUpdate
|
||||||
|
volumeClaimTemplates:
|
||||||
|
- apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: data
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 8Gi
|
||||||
|
volumeMode: Filesystem
|
||||||
@ -0,0 +1,73 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: statping
|
||||||
|
labels:
|
||||||
|
app: statping
|
||||||
|
spec:
|
||||||
|
type: LoadBalancer
|
||||||
|
ports:
|
||||||
|
- port: 9001
|
||||||
|
targetPort: 8080
|
||||||
|
selector:
|
||||||
|
app: statping
|
||||||
|
tier: frontend
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: statping
|
||||||
|
labels:
|
||||||
|
app: statping
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: statping
|
||||||
|
tier: frontend
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: statping
|
||||||
|
tier: frontend
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- image: statping/statping
|
||||||
|
name: statping
|
||||||
|
env:
|
||||||
|
- name: DB_CONN
|
||||||
|
value: postgres
|
||||||
|
- name: DB_HOST
|
||||||
|
value: statping-postgres
|
||||||
|
- name: DB_DATABASE
|
||||||
|
value: statping
|
||||||
|
- name: DB_USER
|
||||||
|
value: statping
|
||||||
|
- name: DB_PASS
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: postgres-pass
|
||||||
|
key: password
|
||||||
|
ports:
|
||||||
|
- containerPort: 8080
|
||||||
|
name: statping
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: importer
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- image: postgres:15.1
|
||||||
|
name: postgres-importer
|
||||||
|
volumeMounts:
|
||||||
|
- name: importer
|
||||||
|
mountPath: /init.d
|
||||||
|
command: ["/init.d/init.sh"]
|
||||||
|
volumes:
|
||||||
|
- name: importer
|
||||||
|
configMap:
|
||||||
|
name: importer
|
||||||
|
defaultMode: 0500
|
||||||
|
restartPolicy: Never
|
||||||
Loading…
Reference in new issue