Clustermangement on PLCnext?

Print

A standard in IT for years, it has not yet made much of an impact in industry. Often such technologies are seen as
too complex and unnecessary. The question that arises is, do they bring us advantages?

A vision for PLCnext using the example of Kubernetes.

 

Kubernetes

 

Kubernete is an orchestrator (management system, master) which uses, among other things, containers and thus forms a network via various devices. The system is used to provide applications in a slightly different way.

Classically applications would be distributed and maintained on devices. It is known on which computer the application runs. If an application should run on another computer this must be done by a person. If one of the computers fails, all applications of the computer are no longer available.

With Kubernetes, the master is given a state description of the application, and the master takes care of the rest. It ensures that the requested state is maintained at all times. However, it is not known on which node the application is currently running, but it is accessible in principle.

 

Questions and answers

 

What deplores condition description

How to install the cluster

How to perform updates of applications

What happens if a node fails

What happens if the master fails

Certain applications need to run on certain nodes because access to the hardware is needed.

 Kubernetes architecture

Example

 

Example of a state description of an application that consists of three containers (frontend, backend, database).

Deployment:

Service:

Ingress:

 

# Kind of the Deployment
kind: Deployment
apiVersion: apps/v1
metadata:
  name: MyApplicationName
  labels:
    app: MyApplication
    MyApplication: MyApplicationName
    namespace: default

## Container specs
    spec:
      containers:

## Container spec for Frontend
## Name for the Container
      - name: MyContainer-frontend

## Container Image to use      
        image: MyApplicationImage_frontend

## Ports for the frontend, http        
        ports:
        - containerPort: 80

## Container spec for Backend      
      - name: MyContainerName-backend
        image: MyApplicationImage_backend
        ports:
        - containerPort: 3000

## Container spec for mongodb          
      - name: MyContainerName-mongo
        image: mongo:3.4

## Startup commands for Mongo DB
        command:
        - "mongod"
        - "--bind_ip"
        - "0.0.0.0"
        ports:
        - containerPort: 27017    
---
## Service declaration, expose Ports to the kubernetes api (only internal rechable)

apiVersion: v1
kind: Service
metadata:
  name: MyApplicationName
spec:
  ports:
  - name: frontend
    targetPort: 80
    port: 80
  - name: backend
    targetPort: 3000
    port: 3000
  selector:
    app: MyApplication
    task: MyApplicationName     

---    
## Ingress declaration, bind proxy to fronted and backend

apiVersion: networking.k8s.io/v1beta1
kind: Ingress

## Bind ingress to traefik service proxy

metadata:
  name:MyApplicationName
  annotations:
    kubernetes.io/ingress.class: traefik

## Ingress class for frontend, map dns ingress to service port 80 
spec:
  rules:
  - host: MyApp.Mydomain.de
    http:
      paths:
      - path: /
        backend:
          serviceName:MyApplicationName
          servicePort: frontend

## Ingress class for backend, map dns ingress to service port 3000          
  - host: MyApplicationName.MyDomain.de
    http:
      paths:
      - path: /api
        backend:
          serviceName:MyApplicationName
          servicePort: backend
 
 

Take a look

 

https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/

https://github.com/k3s-io/k3s

https://github.com/rancher/k3d

https://github.com/inercia/k3x