Difference between revisions of "Orchestrating Telstar with Kubernetes"

From Telstar Wiki
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
== Using Kubernetes ==
== Using Kubernetes ==


Telstar can be managed by Kubernetes if required and the following configuration files present an example of how this could be achieved using either Node ports or a cloud providers Load Balancer.
Although not officially supported, Telstar can be managed by Kubernetes if required and the following configuration files present an example of how this could be achieved using either Node ports or a cloud provider's Load Balancer.


=== Telstar Namspace ===
=== Telstar Namspace ===
Line 77: Line 77:
           containers:
           containers:
           - name: telstar-server
           - name: telstar-server
             image: johnnewcombe/telstar:amd64-2.0-RC3.4
             image: johnnewcombe/telstar:amd64-2.0-RC3.23
             args: ["server", "--init", "--port", "6512"]
             args: ["server", "--init", "--port", "6512"]
             ports:
             ports:

Latest revision as of 08:51, 7 May 2022

Using Kubernetes

Although not officially supported, Telstar can be managed by Kubernetes if required and the following configuration files present an example of how this could be achieved using either Node ports or a cloud provider's Load Balancer.

Telstar Namspace

   {
     "apiVersion": "v1",
     "kind": "Namespace",
     "metadata": {
       "name": "telstar",
       "labels": {
         "name": "telstar"
       }
     }
   }
   

Telstar Server

   apiVersion: v1
   kind: Service
   metadata:
     name: telstar-server
     namespace: telstar
     labels:
       app: telstar-server
   spec:
     type: NodePort
     ports:
     - port: 25232
       nodePort: 30000
       protocol: TCP
     selector:
       app: telstar-server
   #spec:
   #  type: LoadBalancer
   #  ports:
   #    - port: 6502
   #      name: load-balancer
   #  selector:
   #    app: telstar-server
   ---
   apiVersion: v1
   kind: PersistentVolumeClaim
   metadata:
     name: telstar-pvc
     namespace: telstar
   spec:
     accessModes:
     - ReadWriteOnce
     resources:
       requests:
         storage: 1Gi
     storageClassName: do-block-storage
   ---
   apiVersion: apps/v1
   kind: Deployment
   metadata:
     name: telstar-server
     namespace: telstar
   spec:
     replicas: 1
     selector:
       matchLabels:
         app: telstar-server
     minReadySeconds: 10
     strategy:
       type: RollingUpdate
       rollingUpdate:
         maxUnavailable: 1
         maxSurge: 1
     template:
       metadata:
         labels:
           app: telstar-server # this label matches the services label selector
       spec:
         containers:
         - name: telstar-server
           image: johnnewcombe/telstar:amd64-2.0-RC3.23
           args: ["server", "--init", "--port", "6512"]
           ports:
           - containerPort: 25232
           env:
             - name: TELSTAR_SERVER
               value: "KEATS"
             - name: TELSTAR_DBCOLLECTION
               value: "primary"
           volumeMounts:
           - mountPath: "/opt/telstar/volume"
             name: telstar-volume
         volumes:
           - name: telstar-volume
             persistentVolumeClaim:
               claimName: telstar-pvc

Mongob

   apiVersion: v1
   kind: Service
   metadata:
     name: telstar-mongo
     namespace: telstar
     labels:
       app: telstar-mongo
   spec:
     type: NodePort
     ports:
     - port: 27017
       nodePort: 30001
       protocol: TCP
     selector:
       app: telstar-mongo
   ---
   apiVersion: apps/v1
   kind: Deployment
   metadata:
     name: telstar-mongo
     namespace: telstar
   spec:
     replicas: 1
     selector:
       matchLabels:
         app: telstar-mongo
     minReadySeconds: 10
     strategy:
       type: RollingUpdate
       rollingUpdate:
         maxUnavailable: 1
         maxSurge: 1
     template:
       metadata:
         labels:
           app: telstar-mongo # this label matches the services label selector
       spec:
         containers:
         - name: telstar-mongo
           image: mongo
           ports:
           - containerPort: 27017
           env:
             - name: MONGO_INITDB_ROOT_USERNAME
               value: "mongoadmin"
             - name: MONGO_INITDB_ROOT_PASSWORD
               value: "secret"