How Can We Help?

Search for answers or browse our knowledge base.

Deployment | Administration | Support

< All Topics
Print

Kubernetes Deployment

SyncNow Works with kubernetes as a cluster, below is a sample Kubernetes SyncNow Cluster over postrgreSQL. The configuration consists of deployment file with secrets, readiness, liveliness, host affinity, service and nginx ingress.

Place HolderDescriptionExample
{{ .Values.namespace }}Kubernetes namepaceqa
{{ .Values.domain }}Kubernetes DNS domainsyncnow.local
{{ .Values.repourl }}Repository where syncnow docker image can be foundartifacts.syncnow.local
{ .Values.syncnowversion }}syncnow docker image version2.7.0
apiVersion: v1
kind: ConfigMap
metadata:  
  name: syncnow-webapp-configmap    
  labels:
    app: syncnow
data:
  webconfig: |
    {
      "apiEndpoint": "https://{{ .Values.namespace }}.{{ .Values.domain }}"
    }
---
apiVersion: v1
kind: Secret
metadata:
  name: syncnow-db-password 
  labels:
    app: syncnow
type: Opaque
data:  
  password: UTF3MmUzcjR0NQ==
---
apiVersion: v1
kind: Service
metadata:
  name: syncnow-service  
  labels:
    app: syncnow
spec:
  type: ClusterIP
  ports:
    - port: 5030
      targetPort: 5030
  selector:
    app: syncnow
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: syncnow 
  labels:
    app: syncnow 
spec:
  replicas: 3
  selector:
    matchLabels:
      app: syncnow
  template:
    metadata:
      labels:
        app: syncnow            
    spec:               
      containers:
        - name: syncnow
          image: {{ .Values.repourl }}/syncnowserver:{{ .Values.syncnowversion }} 
          #image: artifacts.dev.syncnow.io/syncnowserver:latest
          resources:
            limits:
              memory: "1024Mi"              
          ports:
            - containerPort: 5030
          imagePullPolicy: Always
          securityContext:  
            readOnlyRootFilesystem: false  
            runAsNonRoot: true
            runAsUser: 999
          livenessProbe:
            httpGet:
              path: /api/v1.0/app/Configuration/IsServiceReady
              port: 5030          
            initialDelaySeconds: 10
            periodSeconds: 10            
          readinessProbe:
            httpGet:
              path: /api/v1.0/app/Configuration/IsServiceReady
              port: 5030
            initialDelaySeconds: 10
            periodSeconds: 10             
          volumeMounts:
            - name: syncnow-webapp-volume
              mountPath: /app/WebApp/app.json
              subPath: webconfig
          env:
            - name: SETTINGS__DATABASECONFIGURATION__DATABASETYPE
              value: PostgreSQL
            - name: SETTINGS__DATABASECONFIGURATION__SERVER
              value: postgre{{ .Values.namespace }}-postgresql
            - name: SETTINGS__DATABASECONFIGURATION__PORT
              value: "5432"
            - name: SETTINGS__DATABASECONFIGURATION__USERNAME
              value: SyncNowUser
            - name: SETTINGS__DATABASECONFIGURATION__PASSWORD
              valueFrom:
                secretKeyRef:
                  name: syncnow-db-password 
                  key: password
            - name: SETTINGS__DATABASECONFIGURATION__TRANSPORTENCRYPT
              value: "False"
            - name: SETTINGS__DATABASECONFIGURATION__DATABASE
              value: SyncNow           
            - name: KESTREL__ENDPOINTS__HTTP__URL
              value: http://+:5030
            - name: KESTREL__ENDPOINTS__HTTPS__URL
              value: https://+:5031
      volumes:
        - name: syncnow-webapp-volume
          configMap:
            name: syncnow-webapp-configmap             
      imagePullSecrets:
        - name: repoProd
      affinity:
              podAntiAffinity:
                preferredDuringSchedulingIgnoredDuringExecution:
                  - weight: 100
                    podAffinityTerm:
                      labelSelector:
                        matchExpressions:
                          - key: "app"
                            operator: In
                            values:
                            - syncnow
                      topologyKey: "kubernetes.io/hostname"
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: syncnowingress  
  annotations:    
    ingress.kubernetes.io/ssl-passthrough: "true"
    kubernetes.io/ingress.class: nginx           
spec:
  tls:
    - hosts:
      - {{ .Values.namespace }}.{{ .Values.domain }}
      secretName: syncnowdev
  rules: 
  - host: {{ .Values.namespace }}.{{ .Values.domain }}
    http:
      paths:
      - path: /
        backend:
          serviceName: syncnow-service
          servicePort: 5030
Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.
Previous Docker Compose
Next SyncNow App Configuration
Table of Contents