Kubernetes and Container Orchestration
Benefits of Kubernetes
Using Kubernetes offers numerous advantages for deploying and managing the OPC Router:
- Scalability: Kubernetes allows you to scale the number of OPC Router instances based on current requirements.
- **Flexibility: By using containers, different versions and configurations of the OPC Router can be easily managed and deployed.
- Automation: Kubernetes automates many administrative tasks, including deployments, rollbacks, and scaling, which simplifies management and reduces errors.
Helm Chart for OPC Router
The Helm chart for the OPC Router simplifies the deployment and management of the OPC Router in a Kubernetes cluster. Here are the main features and configuration options:
Deployment:
- Helm Chart: Enables deployment of the OPC Router on any Kubernetes cluster.
- Multiple Configurations: Support for various configuration options to meet specific requirements.
configuration:
- Global Parameters: Settings such as the global Docker image registry and StorageClass.
- Common Parameters: Parameters for customizing the name and service account settings.
- **OPC Router Parameters: Configurations for the OPC Router image, environment variables, and project repository.
- MongoDB Parameters: Settings for MongoDB integration, including authentication and redundancy.
Redundancy:
- OPC Router Redundancy: Support for redundancy mode to run a second pod with an OPC Router runtime that takes over in the event of a failure of the primary pod.
- **MongoDB Redundancy: Ability to run multiple MongoDB pods to provide database redundancy and increase reliability.
Best Practices
To take full advantage of Kubernetes and Helm Charts, the following best practices should be followed:
Private Repositories:
- Ensure that Git repositories are private to prevent unauthorized access.
- Establishing a connection between the OPC Router’s internal Git system and hosted Git servers such as GitHub, Bitbucket, or Microsoft Azure DevOps.
Secrets Management:
- Secrets and passwords should never be stored in a Git repository.
- The OPC Router always stores secrets in a separate local vault to ensure they are not versioned.
Regular Updates and Monitoring:
- Regularly updating the Kubernetes cluster and Helm charts.
- Monitoring the cluster to ensure that all components are functioning and scaling properly.
Practical Implementation
Deployment with Helm Chart:
-
Prerequisites: Ensure that Kubernetes and Helm are installed and configured
-
Add the Helm Repository: Add the OPC Router Helm repository and update it:
helm repo add opc-router https://opc-router.github.io/helm-charts
helm repo update -
Installing the OPC Router: Use the following command to install the OPC Router:
helm install my-opcrouter opc-router/opc-router --set I_do_accept_the_EULA=true -
Security Configuration: Add authentication and security parameters to secure the installation. Write the values to a
values.yamlfile instead of passing them individually via--set:values.yamlwebManagement:
auth:
disable: false
initialUser:
name: <initial-web-management-user>
password: <initial-web-management-password>
mongodb:
auth:
enabled: true
rootPassword: <mongodb-root-password>
replicaSetKey: <mongodb-replicaset-key>
I_do_accept_the_EULA: truehelm install my-opcrouter opc-router/opc-router -f values.yamlwarningDo not pass passwords via
--seton the command line: The command ends up in the shell history and is visible in the process list on the machine. Avalues.yamlshould not be stored in version control in plain text—for production environments, refer to an existing Kubernetes secret or pass individual values via--set-filefrom a file with restricted access rights.
Redundancy and Scaling:
-
Enable OPC Router Redundancy: The redundancy mode is set via the OPC Router’s environment variables, which you pass to the pod—primarily
OR_REDUNDANCY_MODE(primaryorsecondary),OR_REDUNDANCY_SHARED_KEY, and, on the secondary service,OR_REDUNDANCY_ADDRESS. The complete list and the meaning of the values can be found under Safe Redundancy and Configurable Environment Variables. -
MongoDB Redundancy: Ensure that MongoDB is running in redundancy mode by increasing the number of pods:
--set mongodb.replicaCount=3noteUse an odd number of at least three pods. A replica set makes decisions by majority vote: With two pods, the remaining node loses quorum after the other fails and enters a read-only state—redundancy does not work in this case. Only with three or more pods can the set withstand the failure of a single node.
Load the project from the Git repository:
-
Reference the project repository and the path in the Helm chart to load an OPC Router project from a Git repository:
--set project.projectRepo=<git-repository-url> \
--set project.projectPath=<path-to-rpe-project-file> \
--set project.configPath=<path-to-project-config-file> \
--set project.auth.ssh_key=<private-ssh-key>
Summary
Using Kubernetes and Helm Charts provides a powerful and flexible way to run the OPC Router in a scalable and manageable environment. By implementing best practices and taking advantage of the configuration options, organizations can maximize the reliability and efficiency of their OPC Router installations.