Install changedetection on Kubernetes

From Bitbull Wiki
Jump to navigation Jump to search

application setup

export NAMESPACE=changedetection
kubectl create namespace $NAMESPACE
kubectl config set-context --namespace=$NAMESPACE --current


  • vim deployment_changedetection-io.yml
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "4"
    image.openshift.io/triggers: '[{"from":{"kind":"ImageStreamTag","name":"changedetection-io:latest"},"fieldPath":"spec.template.spec.containers[?(@.name==\"changedetection-io\")].image"}]'
  labels:
    app: changedetection-io
  name: changedetection-io
  namespace: changedetection
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      deployment: changedetection-io
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        deployment: changedetection-io
    spec:
      containers:
      - image: ghcr.io/dgtlmoon/changedetection.io:latest
        imagePullPolicy: IfNotPresent
        name: changedetection-io
        ports:
        - containerPort: 5000
          protocol: TCP
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /datastore
          name: changedetection-io
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      terminationGracePeriodSeconds: 30
      volumes:
      - name: changedetection-io
        persistentVolumeClaim:
          claimName: changedetection-io
  • vim pvc_changedetection-io.yml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: changedetection-io
  namespace: changedetection
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 1G
  • vim service_changedetection-io.yml
apiVersion: v1
kind: Service
metadata:
  labels:
    app: changedetection-io
  name: changedetection-io
  namespace: changedetection
spec:
  internalTrafficPolicy: Cluster
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - name: 5000-tcp
    port: 5000
  selector:
    deployment: changedetection-io

kubectl apply -f pvc_changedetection-io.yml
kubectl apply -f deployment_changedetection-io.yml
kubectl apply -f service_changedetection-io.yml

kubectl get all
kubectl exec -it deployments/changedetection-io -- df | grep /datastore
  /dev/mapper/svawx01p-var  73390080 22169432  51220648  31% /datastore

kubectl get svc

curl http://1.2.3.4:5000

kubectl create ingress ingress-www --rule=changedetectin.domain.local/*=changedetection-io:5000