Preview: this product has not been released yet. The description may change before release.
Skip to main content

Installation with Kubernetes

MAC is installed with the Helm chart mac. It creates a Deployment with a Service for every service, together with PodDisruptionBudgets, NetworkPolicies and an Ingress for the interface and the sign-in.

Prerequisites​

  • Kubernetes 1.30 or later and Helm 3.
  • PostgreSQL, provided and backed up by the operator.
  • Redis, provided by the operator: the interface's replicas share in it which sessions have ended (secret mac-ui, key redis-url).
  • An ingress controller (default: ingress-nginx) and a TLS certificate for the two host names.
  • For the NetworkPolicies, a CNI that enforces them, for example Calico or Cilium.
  • For the alerts, optionally the Prometheus Operator.

Creating the secrets​

The chart contains no secrets. It refers to secrets with fixed names (mac-database, mac-identity and others). Which secrets with which keys are needed is shown in examples/secrets.yaml in the chart. Create these secrets in the namespace before installing, with kubectl, an External Secrets operator or Sealed Secrets. The keys the services and the interface authenticate with at the identity (private_key_jwt) are made by the chart itself, in the secret mac-client-keys; they are kept on every upgrade.

In examples/secrets.yaml the secret mac-identity carries the placeholder REPLACE-ME for admin-password, the password of the first administrator. Replace it with a random password of your own that meets the password rules of the identity: at least 8 characters, an upper-case letter, a lower-case letter, a digit, a special character. The first sign-in asks for a new password. If the placeholder is left or the value breaks the rules, the identity pod does not start (CrashLoopBackOff; kubectl -n mac logs deploy/mac-identity gives the code identity.admin-user.password-invalid, the setting and the rules broken, never the password); the chart does not let the placeholder through silently.

Installing​

kubectl create namespace mac
kubectl -n mac apply -f secrets.yaml
helm install mac ./mac -n mac \
--set global.hosts.app=mac.example.com \
--set global.hosts.identity=identity.example.com \
--set global.domain=example.com \
--set global.image.tag=<version>

Further values are documented in values.yaml, such as the image registry, the number of replicas, the resources and the annotations of the LoadBalancer.

The service does not start​

A service that cannot start because of its configuration ends with exit code 78 and writes as the last line of its log what to do: a code, the setting and what is wrong with it. A password or key is never in it. Any other failure at the start ends with exit code 1, and its stack trace stands before it.

  1. kubectl get pods: the pod shows CrashLoopBackOff or Error.
  2. kubectl describe pod <pod>: under Last State it says Terminated with Exit Code 78 and the message as Message. The chart sets terminationMessagePolicy: FallbackToLogsOnError for it: Kubernetes takes the end of the log (at most 2048 bytes or 80 lines), and the message is the last line.
  3. kubectl logs <pod> --previous --tail 5 shows the same message in the log.
  4. Correct the setting it names (in the values or in the secrets) and run helm upgrade.

Kubernetes keeps restarting the pod, with growing pauses, until the setting is right.

Checking​

kubectl -n mac get deploy -l app.kubernetes.io/part-of=mac

Every service answers on /alive (the process responds) and /ready (its dependencies are there). Kubernetes takes a pod out of traffic while /ready fails and restarts it when /alive fails. The page System → Overview of the interface shows every instance with its version and state.

Publishing a connector's listening port​

Some connectors are servers: Modbus TCP waits on port 502 for the reading system (PLC, control room), an OPC UA server on 4840. The connector binds its port inside the Application Center; it is reachable from outside only once the installation publishes it. Nothing is opened wholesale: in every operating mode the default is off, with no range published in advance and no proxy. The port is a parameter of the connector; the connector's page shows it under Status, and the Application Center keeps it unique across all connectors. Modbus TCP has neither authentication nor encryption: publish the port only into the plant network, never to the internet.

In the chart this is connectorListeners in the values. There are two ways, never both at once (the chart refuses the mix):

  • By hand (the way when you publish): list one port per connector under connectorListeners.ports (name at most 15 characters). The chart creates the Service mac-applicationcenter-listeners with exactly these ports and lists them as containerPort in the pod. The type (ClusterIP for a plant network inside the cluster, NodePort or LoadBalancer for one outside), annotations (such as metallb.io/loadBalancerIPs) and externalTrafficPolicy live under connectorListeners.service. Example: deploy/helm/mac/examples/connector-listeners.yaml. Then helm upgrade.
  • The Application Center keeps the Service (option, off by default): connectorListeners.managed.enabled=true. A port appears with the connector and disappears with it, without helm upgrade. For this the chart creates a ServiceAccount of its own, a Role on services (get, create, patch, delete) and the RoleBinding, all in this namespace only. Annotations with a slash in the key cannot be set this way; if you need a fixed address, use the manual way. If a pass fails (Role missing, API server unreachable) the Application Center keeps running: the listener-service check reports the cause. Example: deploy/helm/mac/examples/connector-listeners-managed.yaml.

The management API stays in the Service mac-applicationcenter, cluster-internal; listening ports never go there.

Your own CA in front of the interface​

The interface calls the identity (the sign-in) from its server on the identity's public address: discovery document, token, user info and sign-out go over https:// and the name of the identity (AUTH_IDENTITY_URL). It is the process of the interface that does this, not the browser. It is the only public address the interface calls itself; its connections to the Application Center and Messaging run internally over http (see "Network and encryption"). Two things have to hold:

  • The name of the identity resolves and is reachable from the interface. The server of the interface must reach the public address of its own reverse proxy (hairpin).
  • The interface trusts the certificate of the proxy. If it comes from a private or company CA, Node does not know that CA and refuses the call.

When nothing needs to be done: the certificate comes from a publicly trusted CA (such as Let's Encrypt; Node ships their roots) and the name resolves. Then this section does not apply.

How to recognise it: sign-in fails, and the log of the interface says [auth/callback] sign-in failed. The cause shows in a call from the environment of the interface (command below): with a CA Node does not trust it reports UNABLE_TO_VERIFY_LEAF_SIGNATURE; if the name does not resolve, ENOTFOUND or EAI_AGAIN; if it is not reachable, ECONNREFUSED or ETIMEDOUT. 200 means all is well.

Steps:

  1. Create the certificate of the CA (PEM, the CA's certificate only, never a key) as a Secret in the namespace, key ca.crt: kubectl -n mac create secret generic mac-ca --from-file=ca.crt=ca.pem. A ConfigMap works as well (trustedCa.source=configMap); the name is <product>-ca when trustedCa.name is empty.
  2. Switch the option on, it is off by default: helm upgrade mac ./mac -n mac --reuse-values --set trustedCa.enabled=true, or with -f examples/trusted-ca.yaml. The chart mounts the certificate at /etc/noritec/ca in the pods of the interface and sets NODE_EXTRA_CA_CERTS; no other service gets it. If the Secret is missing, the pod does not start (event FailedMount).
  3. If the name of the identity does not resolve in the cluster, solve that in the cluster (DNS zone or CoreDNS); the chart sets nothing for it.

helm upgrade rolls out the pods of the interface by itself, because their pod template changes. Afterwards run the same call; it must answer 200:

kubectl -n mac exec deploy/mac-ui -- node -e "fetch('https://<MAC_IDENTITY_HOST>/.well-known/openid-configuration').then(r => console.log(r.status), e => console.log(e.cause?.code ?? e.message))"

Network and encryption​

The services of MAC speak plain http to each other, without TLS: the interface to the Application Center and the messaging service, the Application Center and the messaging service to the identity, and the identity to the messaging service. This is intended: the protection of these connections lies in the operating mode, not in each service. The identity therefore accepts the direct http calls of the services at their endpoints (InternalHttp__Enabled, set in the settings), at the endpoints the services need (discovery document, key set, token); every other endpoint and the pages still ask for https.

Encrypted are the connections that leave the network: the browser to the reverse proxy or ingress (TLS ends there), the Application Center at a Service Center (SCACI and its enrolment, TLS with a client certificate). Which connection is TLS is in the code of the services and in the settings of this operating mode; whatever is not named here is http.

Requirement on the reverse proxy or ingress: it offers only https to the outside (redirect http to https or close the port). The identity accepts http at the endpoints named, wherever it comes from; the entry of the installation is what keeps it from the outside.

Kubernetes does not encrypt the traffic between pods by itself. With more than one node the traffic between the services leaves the node in plain text. Therefore:

  • Prerequisite (more than one node): the network of the pods is encrypted, either through the CNI plugin (for example the WireGuard encryption of Cilium or Calico) or through a service mesh with mTLS (for example Istio or Linkerd). Without one of the two an installation with several nodes is not supported. This is a matter of the platform you install on and not part of the product.
  • One node: not needed, the traffic does not leave the node.
  • Two points of precision. Encryption through the CNI protects the traffic between nodes; what runs between two pods on the same node stays unencrypted (as the documentation of Cilium and Calico describes it), and a node without the encryption stays unprotected. A service mesh protects only what runs in strict mode: in Istio the mode PERMISSIVE, the default when nothing else is set, also lets plain text through; in Linkerd a pod without the proxy still accepts plain text unless a policy forbids it. Set the mesh so that plain text to the pods of this product is refused.
  • The network policies of the chart (networkPolicies.enabled, on by default) limit which service reaches which; they encrypt nothing and work only with a CNI that enforces them.

Check the statements about your CNI or mesh in its documentation before you rely on them; options and names change with the versions. PostgreSQL and Redis speak as the secrets of the installation, which you create, say; set encryption there in the connection strings (Npgsql: SSL Mode, StackExchange.Redis: ssl=true).

Upgrading​

helm upgrade mac ./mac -n mac --reuse-values --set global.image.tag=<new version>

The services migrate their database themselves when they start. The Application Center runs with exactly one replica and is replaced rather than updated side by side; all other services roll without interruption.

Uninstalling​

helm uninstall mac -n mac removes the services. The volume of the Application Center is kept so that its enrolled identity is not lost; delete it yourself if needed.