add k8s deploy resource

pull/164/head
ZhangQiuSheng 2019-01-03 14:13:18 +08:00 committed by qiang.ou
parent ec4a4c0855
commit b0012f3ee7
4 changed files with 144 additions and 0 deletions

View File

@ -0,0 +1,17 @@
FROM alpine:3.7
ENV GOCRON_AGENT_VERSION=v1.5
RUN apk add --no-cache ca-certificates tzdata bash \
&& mkdir -p /app \
&& wget -P /tmp https://github.com/ouqiang/gocron/releases/download/${GOCRON_AGENT_VERSION}/gocron-node-${GOCRON_AGENT_VERSION}-linux-amd64.tar.gz \
&& cd /tmp \
&& tar zvxf gocron-node-${GOCRON_AGENT_VERSION}-linux-amd64.tar.gz \
&& mv /tmp/gocron-node-linux-amd64/gocron-node /app \
&& rm -rf /tmp/* \
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
WORKDIR /app
EXPOSE 5921
ENTRYPOINT ["/app/gocron-node", "-allow-root"]

View File

@ -0,0 +1,38 @@
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: gocron-agent
namespace: kube-system
spec:
selector:
matchLabels:
daemon: gocron-agent
template:
metadata:
labels:
daemon: gocron-agent
name: gocron-agent
spec:
containers:
- name: gocron-agent
image: crontab-agent:0.5
imagePullPolicy: IfNotPresent
ports:
- containerPort: 5921
hostPort: 5921
name: gocron-agent
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /var/log
name: syslog
hostNetwork: true
hostPID: true
restartPolicy: Always
volumes:
- hostPath:
path: /var/log
type: Directory
name: syslog

View File

@ -0,0 +1,36 @@
---
apiVersion: v1
kind: Service
metadata:
name: gocron
labels:
app: gocron
spec:
ports:
- port: 5920
name: gocron
type: NodePort
selector:
app: gocron
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
labels:
name: gocron
name: gocron
spec:
replicas: 1
selector:
matchLabels:
app: gocron
template:
metadata:
labels:
app: gocron
spec:
containers:
- name: gocron
image: ouqg/gocron
ports:
- containerPort: 5920

53
k8s-deploy/mysql-st.yaml Normal file
View File

@ -0,0 +1,53 @@
---
apiVersion: v1
kind: Service
metadata:
name: mysql
#namespace: storage
labels:
app: mysql
spec:
ports:
- port: 3306
name: mysql
clusterIP: None
selector:
app: mysql
---
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: mysql
#namespace: storage
spec:
serviceName: "mysql"
replicas: 1
template:
metadata:
labels:
app: mysql
spec:
terminationGracePeriodSeconds: 10
containers:
- name: mysql
image: mysql:5.6
env:
- name: MYSQL_ROOT_PASSWORD
value: password
- name: MYSQL_DATABASE
value: crontab
ports:
- containerPort: 3306
name: mysql
volumeMounts:
- name: mysql-vol
mountPath: /var/lib/mysql
volumeClaimTemplates:
- metadata:
name: mysql-vol
spec:
storageClassName: rbd # 需要storageClassName
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 100Gi