Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Customize JCNR Configuration

SUMMARY Read this topic to understand how to customize JCNR configuration using a ConfigMap.

JCNR ConfigMap

Starting with Juniper Cloud-Native Router (JCNR) Release 23.3, JCNR supports customizing configuration using a ConfigMap when deployed in L3 mode. In cloud-based deployments, in the event of a node failure, the JCNR pods may be spawned on newer or different nodes. A ConfigMap decouples the configuration parameters from node names and is based on node labels instead. This enables the JCNR CNI deployer to consume the configuration parameters, apply them to the cRPD configuration template and render the configuration, as long as a matching label is available for the node.

A ConfigMap is an API object to store data in key-values pairs. A ConfigMap defines per node variables that are consumed by nodes matching the label. The key-value pairs are used to render the configuration via a go template. The configured template must be available in the Juniper_Cloud_Native_Router_release_number/helmchart/charts/jcnr-cni/files/ directory for the configuration to be applied to the cRPD pods.

Note:

You must apply the ConfigMap before installing JCNR to create cRPD pods with custom configuration. The cRPD pod must be deleted and respawned should you wish to apply the configuration parameters any time after JCNR installation. The configuration parameters are applied by default to any newly spawned cRPD pods. The JCNR customization via ConfigMap is optional.

Note:

JCNR also supports customization via node annotations for backward compatibility with previous releases. Considering that node annotations are coupled with node names, it is highly recommended to customize JCNR via ConfigMaps, specifically for cloud deployments. Refer to Customize JCNR Configuration using node annotations for more information.

Configuration Example

Sample ConfigMap and template files are available under Juniper_Cloud_Native_Router_<release-number>/helmchart/cRPD_examples directory.

You define the key-value pair for different node labels in your cluster. An example of the jcnr-params-configmap.yaml file is provided below:

The key-value pairs you define in the annotations is used to render the cRPD configuration via a go template. An example of the jcnr-cni-custom-config-cm.tmpl template file is provided below:

Note:

You can define additional cRPD configuration hierarchies in the template. The values to be rendered from the ConfigMap defined in the jcnr-params-configmap.yaml must be defined as {{.Params.var-name}}. Any environment variables, such as variables defined in values.yaml, must be defined as {{.Env.variable_name}}.

Complete the following steps to apply the customizations.

  1. Label each node based on the keys used in the ConfigMap.

  2. Apply the ConfigMap to the cluster nodes using the command provided below:
  3. Once the template is configured, you must copy the jcnr-cni-custom-config.tmpl file to the Juniper_Cloud_Native_Router_release_number/helmchart/charts/jcnr-cni/files/ directory.
  4. Deploy the cloud-native router components, including the cRPD. Once the installation completes, access the cRPD CLI and issue the show configuration | display set command in the cli mode to view the custom configuration you applied.

Modifying the ConfigMap

If you wish to change the ConfigMap any time after JCNR installation, you must delete the cRPD pod and respawn it using the following command:This triggers a rolling restart of all cRPD pods. Alternatively, you can identify the cRPD pods on nodes for which the ConfigMap has changed and manually delete the pod. The ConfigMap changes will be applied automatically to any respawned pods.

Troubleshooting

The cRPD pod continues to restart in CrashLoopBackOff state if invalid configuration is rendered and applied via the go template. The rendered configuration is saved in /config directory on the JCNR host as juniper.conf.master. You can apply the rendered configuration manually to a running cRPD pod to validate the configuration and identify issues. For an AWS EKS deployment you can find the rendered config within the cRPD pod in the /config directory.