kubernetes部署soar-web查询工具

  sre

gitlab

dockerfile

FROM python:3.6-alpine3.8
MAINTAINER  becivells <becivells@gmail.com>
#glib
RUN apk --no-cache add ca-certificates  \
&& wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \
&& cd /tmp/&& wget  https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.28-r0/glibc-2.28-r0.apk \
&& apk add glibc-2.28-r0.apk && rm -rf /tmp/*

RUN  apk add --no-cache --virtual .build-deps \
        gcc \
        g++ \
        libffi-dev \
        openssl-dev \
        && wget https://codeload.github.com/xiyangxixian/soar-web/zip/master -O /home/soar-web-master.zip \
        && cd /home/ && unzip soar-web-master.zip&& cd soar-web-master \
        && pip install -r requirement.txt && apk del .build-deps && rm -rf /home/soar-web-master.zip && rm -rf /tmp/*
RUN chmod -R 755 /home/soar-web-master
WORKDIR  /home/soar-web-master
EXPOSE 5077
CMD ["python","/home/soar-web-master/soar-web.py"]

/home

pvc

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: soar-web-home
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: "32Gi"
  volumeName: 
  storageClassName: nfs

k8s

apiVersion: apps/v1
kind: Deployment
metadata:
  name: soar-web
spec:
  replicas: 1
  selector:
    matchLabels:
      sql: soar-web
    strategy:
      type: RollingUpdate
      rollingUpdate:
        maxSurge: 10%
        maxUnavailable: 10%
  template:
    metadata:
      labels:
        sql: soar-web
    spec:
      containers:
      - name: soar-web
        image: becivells/soar-web
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 5077
          name: soar-web
          protocol: TCP
        volumeMounts:
        - name: soar-web-home
          mountPath: /home
      volumes:
       - name: soar-web-home
         persistentVolumeClaim:
           claimName: soar-web-home
---
kind: Service
apiVersion: v1
metadata:
  labels:
    sql: soar-web
  name: soar-web
spec:
  type: NodePort
  ports:
  - name: soar-web
    port: 5077
    nodePort: 30025
    targetPort: 5077
    protocol: TCP
  selector:
    sql: soar-web

LEAVE A COMMENT

Captcha Code