nplus-environment-toolbox#

Installs the environment toolbox with git and nstore downloader installed, also serving as target for pool copy actions in the pipeline

nplus-environment-toolbox Chart Configuration#

You can customize / configure nplus-environment-toolbox by setting configuration values on the command line or in values files, that you can pass to helm. Please see the samples directory for details.

In case there is no value set, the key will not be used in the manifest, resulting in values taken from the config files of the component.

Template Functions#

You can use template functions in the values files. If you do so, make sure you quote correctly (single quotes, if you have double quotes in the template, or escaped quotes).

Global Values#

All values can be set per component, per instance or globally per environment.

Example: global.ingress.domain sets the domain on instance level. You can still set a different domain on a component, such as administrator. In that case, simply set ingress.domain for the administrator chart and that setting will have priority:

  • Prio 1 - Component Level: ingress.domain
  • Prio 2 - Instance Level: global.ingress.domain
  • Prio 3 - Environment Level: global.environment.ingress.domain

Using Values in Templates#

As it would be a lot of typing to write .Values.ingress.domain | default .Values.global.ingress.domain | default .Values.global.environment.ingress.domainin your template code, this is automatically done by nplus. You can simply type .this.ingress.domain and you will get a condensed and defaulted version of your Values.

So an example in your values.yaml would be:

administrator:
  waitFor:
    - '-service {{ .component.prefix }}nappljobs.{{ .Release.Namespace }}.svc.cluster.local:\{{ .this.nappl.port }} -timeout 600'

This example shows .this.nappl.port which might come from a component, instance or global setting. You do not need to care. The .Release.Namespace is set by helm. You have access to all Release and Chart Metadata, just like in your chart code.

The .component.prefix is calculated by nplus and gives you some handy shortcuts to internal variables:

  • .component.chartName The name of the chart as in .Chart.Name, but with override by .Values.nameOverride

  • .component.shortChartName A shorter Version of the name - nappl instead of nplus-component-nappl

  • .component.prefix The instance Prefix used to name the resources including -. This prefix is dropped, if the .Release.Name equals .Release.Namespace for those of you that only run one nplus Instance per namespace

  • .component.name The name of the component, including .Values.nameOverride and some logic

  • .component.fullName The fullName inlcuding .Values.fullnameOverride and some logic

  • .component.chart Mainly the Chart.Name and Chart.Version

  • .component.storagePath The path where the component config is stored in the conf PVC

  • .component.handler The handler (either helm, argoCD or manual)

  • .instance.name The name of the instance, but with override by .Values.instanceOverride

  • .instance.group The group, this instance belongs to. Override by .Values.groupOverride

  • .instance.version The nscale version (mostly taken from Application Layer), this instance is deploying.

  • .environment.name The name of the environment, but with override by .Values.environmentNameOverride

Keys#

You can set any of the following values for this component:

KeyDescriptionDefault
envSets additional environment variables for the configuration.
envMapSets the name of a configMap, which holds additional environment variables for the configuration. It is added as envFrom configMap to the container.
envSecretSets the name of a secret, which holds additional environment variables for the configuration. It is added as envFrom secretRef to the container.
fullnameOverrideThis overrides the output of the internal fullname function
image​.namethe name of the image to use"toolbox2"
image​.pullSecretsyou can provide your own pullSecrets, in case you use a private repo.["nscale-cr", "nplus-cr"]
image​.repoif you use a private repo, feel free to set it here"git.42i.org/nplus"
image​.tagthe tag of the image to use. The nscale images carry the tag of the newest version file (versions/latest.yaml), your own version file overrides it. The images of nplus itself (toolbox, operator, remote management server) leave it empty: it is the version of the chart.
initContainersOptional hook to add your own init containers to any of the components. Will be omitted if empty. Example: initContainers: - name: myInit image: myImage command: [ “/startup.sh” ]{}
meta​.languageSets the language of the main service (in the service container). This is used for instance if you turn OpenTelemetry on, to know which Agent to inject into the container.
meta​.partOfThe value of the label app.kubernetes.io/part-of, which every object and every pod carries. The default nscale is set in the values of the instance and the environment (global.meta.partOf); change it there to group an instance for dashboards and metric tools, for instance per tenant, or set it to an empty string ("") to drop the label. A app.kubernetes.io/part-of in template.labels wins on the pods. A component on its own has no default and renders no label.
meta​.providersets provider (partner, reseller) information to be able to invoice per use in a cloud environment
meta​.serviceContainerThe container name of the main service for this component. This is used to define where to inject the telemetry agents, if any
meta​.stageA optional parameter to indicate the stage (DEV, QA, PROD, …) this component, instance or environment runs in. This can be used in template functions to add the stage to for instance the service name of telemetry services like open telemetry. (see telemetry example)
meta​.tenantsets tenant information to be able to invoice per use in a cloud environment
meta​.typethe type of the component. You should not change this value, except if you use a pipeliner in core mode. In core mode, it should be core, else pipeliner This type is used to create cluster communication for nappl and nstl and potentially group multiple replicaSets into one service."envtoolbox"
meta​.waveSets the wave in which this component should be deployed within an ArgoCD deployment if unset, it uses the default wave thus all components are installed in one wave, then relying on correct wait settings just like in a helm installation
minReplicaCountTypeif you set minReplicaCountType, a podDesruptionBudget will be created with this value as minAvailable, using the component type as selector. This is useful for components, that are spread across multiple replicaSets, like sharepoint or storage layer
nameOverrideThis overrides the output of the internal name function
nodeSelectorselect specific nodes for this component
nstoreDownloader​.enabledenables the nstore downloaderfalse
nstoreDownloader​.nstoreset the nstore URLhttps://nstore.ceyoniq.com...
nstoreDownloader​.targettarget directory in the conf pv"pool/nstore"
probesOptional means to override the default probes of the main container of the component
resources​.limits​.cpuThe maximum allowed CPU for the container"1"
resources​.limits​.memoryThe maximum allowed RAM for the container"512Mi"
resources​.requests​.cpuSet the share of guaranteed CPU to the container."1m"
resources​.requests​.memorySet the share of guaranteed RAM to the container"64Mi"
security​.containerSecurityContext​.allowPrivilegeEscalationSome functionality may need the possibility to allow privilege escalation. This should be very restrictive
you should not change this
info only, do not change
false
security​.containerSecurityContext​.readOnlyRootFilesystemsets the container root file system to read only. This should be the case in production environment
you should not change this
info only, do not change
true
security​.podSecurityContext​.fsGroupThe file system group as which new files are created
there is normally no need to change this
info only, do not change
1001
security​.podSecurityContext​.fsGroupChangePolicyUnder which condition should the fsGroup be changed
there is normally no need to change this
info only, do not change
"OnRootMismatch"
security​.podSecurityContext​.runAsNonRootDeclares that the container must run as a non-root user (Pod Security Standard “restricted”). The images run as 1001 anyway; this refuses to start a pod whose image would run as root (nplus/nplus#85).true
security​.podSecurityContext​.runAsUserThe user under which the container ist run. Avoid 0 / root. The container should run in a non-root context for security
there is normally no need to change this
info only, do not change
1001
security​.zeroTrustturns on Zero Trust Mode, disabling all http communication, even the internal http probesfalse
telemetry​.openTelemetryturns Open Telemetry on
telemetry​.serviceNameSets the service name for the telemetry service to more convenient identify the displayed component Example: “{{ .this.meta.type }}-{{ .instance.name }}”
terminationGracePeriodSecondsSets the terminationGracePeriodSeconds for the component If not set, it uses the Kubernetes defaults
timezoneset the time zone for this component to make sure log output has a specific timestamp, internal dates and times are correct (like the creationDate in nappl) etc.Europe/Berlin
tolerationsSet tolerations for this component
utils​.debugTurn debugging on will give you stack trace etc. Please check out the Chart Developer Guidefalse
utils​.disableWaitin case you use the argoCD Wave feature, you might think about switching off the waitFor mechanism, that makes sure PODs are only started after pre-requisites are fulfilled. You can disable the starndard wait mechanism, but at your own risk, as this might start components even if they are not intended to run yet.false
utils​.disableWaveIf you use argoCD, you most likely want to use the argo Wave Feature as well, making sure the components of an instance are deployed ordered. However, in DEV you might want to disable this to allow live changing components while previous waves are not finished yet.false
utils​.includeNamespaceBy default, the namespace is rendered into the manifest. However, if you want to use helm template and store manifests for later applying them to multiple namespaces, you might want to turn this false to be able to use kubectl apply -n <namespace> -f template.yaml latertrue
utils​.maintenancein Maintenance Mode, all waitFor actions will be skipped, the Health Checks are ignored and the pods will start in idle, not starting the service at all. This will allow you to gain access to the container to perform recovery and maintenance tasks while having the real container up.false
utils​.renderCommentsYou can turn Comment rendering on to get descriptive information inside the manifests. It will also fail on depricated functions and keys, so it is recommended to only switch it off in PRODtrue

Timzone (Package tzdata) setting#

You can set the timezone in the PODs by

  • per Component: timezone: "Europe/Berlin"
  • per Instance: global.timezone: "Europe/Berlin"
  • per Environment: global.environment.timezone: "Europe/Berlin"

This is compatible to the tzdata package. If the image you use uses a different timezone package und thus a environment variable other than TZ, you can also set any global ENV Variables by

  • per Component: env.TZ: "Europe/Berlin"
  • per Instance: global.env.TZ: "Europe/Berlin"
  • per Environment: global.environment.env.TZ: "Europe/Berlin"

If you do not set the timezone, it defaults to Europe/Berlin and the TZ env variable.

A key set on several levels appears once, with the value of the nearest level: component before instance before environment, like every other value. Different keys of all levels are combined. An explicit TZ in env wins over the timezone value. To remove a key that a lower level sets, use override: override.env.MYKEY: null.

Up to 26.3, the environment level won over the instance and the component for env. If you relied on that, set the value on the component or use override.

Placement#

The charts set a required (hard) inter pod anti-affinity: two replicas of the same set are never placed on the same node. A component therefore needs as many nodes as it has replicas; a replica without a free node stays Pending. The only exception is the Elasticsearch of aisearch, which only prefers to spread its pods across nodes.

This is done for nappl, rs, ilm, cmis, web, webdav based on instance, component and type For the nstl, this is handled by instance and type only, since the nstl does not use replicas and we are using different sets to ensure HA.

Additionally, you can set the scheduler to avoid or prefer specific nodes by setting tolerations and use nodeSelectors:

  • tolerations List of Kubernetes tolerations to add to the component
  • nodeSelector Kubernetes nodeSelector to add to the component

Maintenance Mode#

You can start the component in Maintenance Mode, starting the pod without starting the service, providing the possibility to gain access to the container to perform recovery tasks that need to be done offline.

In order to do this:

  • All waitFor definitions are ignored
  • All Health Checks are ignored
  • The container starts in idle

minReplicaCountType#

If you set minReplicaCountType, a podDesruptionBudget will be created with this value as minReplicaCount. It will select pods based on the type of this component. This is used for components, that do not support multiple replicas (for example sharepoint or storage layer).

If the component does in fact support replicas, it is better to use minReplicaCount instead.

Also pay attention to only set this on one ReplicaSet of this type, not all.

Please refer to the HA sample for more information.

Specifying your own init container#

You can specify your own init container to any of the components by adding them unter the initContainers key:

initContainers:
  - name: myInit
    image: myImage
    command: [ "/startup.sh" ]

Any setting will be added to the template section of the component just like specified.

Common Image Configuration#

The image configuration consists of

  • the Image Name
  • the Image Repository
  • the Image Tag
  • the Image Pull Policy

If the Pull Policy is not set, it is automatically IfNotPresent.

Which tag runs#

  • The nscale images (and the third-party images nscale needs) have the registry, name and tag of the newest nscale version as their default. That default is only meant for test systems; it moves with every nplus release. In production you stack your own version file with --values: it sets registry, image name and tag of every nscale component, see the versioning guide.
  • The nplus images (toolbox, operator, remote management server) have an empty tag. It is the version of the chart that renders the image, so they always come with the chart you install and a version file cannot roll them back.

The Repository can be overridden at Instance Level and Environment Level to accomodate multiple stages:

image:
  name: test
  tag: 1.0.0
  repo: git.42i.org/nplus      # Prio 3
  pullPolicy: Always
global:
  repo: myrepo_i1               # Prio 4
  repoOverride: myrepo_i2       # Prio 2
  environment:
    repo: myrepo_e1             # Prio 5
    repoOverride: myrepo_e2     # Prio 1

In this example, finding the repo to use would be:

$repo := global.environment.repoOverride | default global.repoOverride | default image.repo | default global.repo | default global.environment.repo

Once you override the repo, you might als want to override the pullSecrets globally to allow login to your private registry. Since you do not want to do that per image definition, you - just like the repos - can override that globally:

global:
  pullSecretsOverride:
    - myPrivateRegistrySecret

The override procedure is identical to the repo example above.

The Use Case is to easily enable you to download the images to a private and secure registry. nplus by default uses the official registries, but that is most likely not wanted by enterprise customers. So you can just set your own registry in the environment and keep dev, qa and prod apart and secured.

Security settings#

You can set the security options per component, per instance or per environment. The priority is:

  1. component
  2. instance
  3. environment

It is recommended to set the security per environment to make sure you do not forget a component.

Illumio#

Example environment setting for Illumio:

global:
  environment:
    security:
      illumio:
        enabled: true
        loc: "mylocation"
        supplier: "mysupplier"
        platform: "myplatform"
        readinessGates:
          - conditionType: "com.illumio.policy-ready"

CNI, such as Calico or Cilium#

Example environment setting for CNI:

global:
  environment:
    security:
      cni:
        defaultIngressPolicy: deny
        defaultEgressPolicy: deny
        createNetworkPolicy: true
        excludeUnusedPorts: false

excludeUnusedPorts can add a port config to your ingress rules. However, not every CNI is capable of all Attributes (like EndPort is currently not supported by cilium). So you can switch this off, if your CNI does not support it.

zeroTrust Policy#

Some Tools like Cilium transparently encrypt the Node to Node traffic in a Cluster. If you, however, want to aditionally deny all http traffic within a node, you can enable zeroTrust by setting:

global:
    security:
      zeroTrust: true

Please make sure you also set all backendProtocols to https. For a complete example, please see the sample values file zerotrust.yaml in the samples directory.

Encrypted backend#

An optional approach to zeroTrust (see above) is to set the backendProtocol to https. This leaves the http ports available (zeroTrust would not), but switches the component backend traffic to https (for ingress, probes, …).

It is not as strict as zeroTrust and can be set per component like this:

ingress:
  backendProtocol: https

Please see the example file encrypt.yaml in the samles directory for more information.

Security Context#

You can add a containerSecurityContext to the component by adding it in the values file:

security:
  containerSecurityContext:
    capabilities:
      drop: ["ALL"]

Additionally, add a podSecurityContext if desired:

security:
  podSecurityContext:
    runAsNonRoot: true
    runAsUser: 1000
    runAsGroup: 1000

Note: This setting can not be set on instance or environment level.

Rootless and seccomp by default (26.4)#

The chart defaults declare the two fields the Pod Security Standard “restricted” asks for:

  • runAsNonRoot: true — the images run as user 1001 anyway (except the database images, which use their own non-root user); this field makes the kubelet refuse to start a pod whose image would run as root.
  • seccompProfile.type: RuntimeDefault — the container runtime’s default profile, a declaration without a change in behaviour.

With readOnlyRootFilesystem, allowPrivilegeEscalation: false and capabilities.drop: ["ALL"] (which the charts set already), a rendered workload passes a “restricted” Pod Security Admission. Keep fsGroup at the image’s file system group (1001 for the nscale images, 999 for PostgreSQL) — it is not a style choice: a different group breaks the permissions on existing volumes.

Handing Resources to Components#

By default, no resources are set on the container. Thus, Kubernetes handles the container with best effort.

Resources can be set at

KeyDescriptionDefault
resources.requests.cpusets the request, which is the minimum guaranteed-
resources.requests.memorysets the request, which is the minimum guaranteed-
resources.limits.cpusets the limit, which is the maximum allowed-
resources.limits.memorysets the limit, which is the maximum allowed-
  • if nothing is defined, Kubernetes handles it BestEffort
  • if requests are defined, but no limits, Kubernetes handles it Burstable
  • if requests and limits are defined for cpu and memory and the requests equal the limits, Kubernetes handles it Guaranteed (otherwise Burstable)

Please take caution when setting parameters and also have a look at this interesting article regarding resources and JVM resource handling:

https://xebia.com/blog/kubernetes-and-the-jvm/