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 Configlet custom resource.

Configlet Custom Resource

Starting with Juniper Cloud-Native Router (JCNR) Release 24.2, we support customizing JCNR configuration using a configlet custom resource. The configlet can be generated either by rendering a predefined template of supported Junos configuration or using raw configuration. The generated configuration is validated and deployed on the JCNR controller (cRPD) as one or more Junos configuration groups.

Note:

We do not recommend configuring JCNR controller (cRPD) directly through the CLI. You must perform all configuration using the configlet custom resource. The configuration performed directly through the cRPD CLI does not persist through node reboots or pod crashes.

Configuration Examples

You create a configlet custom resource of the kind Configlet in the jcnr namespace. You provide raw configuration as Junos set commands.

Use crpdSelector to control where the configlet applies. The generated configuration is deployed to cRPD pods on nodes matching the specified label only. If crpdSelector is not defined, the configuration is applied to all cRPD pods in the cluster.

An example configlet yaml is provided below:

You can also use a templatized configlet yaml that contains keys or variables. The values for variables are provided by a configletDataValue custom resource, referenced by configletDataValueRef . An example templatized configlet yaml is provided below:

To render configuration using the template, you must provide key:value pairs in the ConfigletDataValue custom resource:

The generated configuration is validated and applied to all or selected cRPD pods as a Junos Configuration Group.

Applying the Configlet Resource

The configlet resource can be used to apply configuration to selected or all cRPD pods either when JCNR is deployed or once the cRPD pods are up and running. Let us look at configlet deployment in detail.

Applying raw configuration

  1. Create raw configuration configlet yaml. The example below configures a loopback interface in cRPD.

  2. Apply the configuration using the kubectl apply command.

  3. Check on the configlet.

    When a configlet resource is deployed, it creates additional node configlet custom resources, one for each node matched by the crpdSelector.

    If the configuration defined in the configlet yaml is invalid or fails to deploy, you can view the error message using kubectl describe for the node configlet custom resource.

    For example:

    The following output has been trimmed for brevity:

  4. Optionally, verify the configuration on the Access cRPD CLI shell in CLI mode. Note that the configuration is applied as a configuration group named after the configlet resource.

    Note:

    The configuration generated using configlets is applied to cRPD as configuration groups. We therefore recommend that you not use configuration groups when specifying your configlet.

Applying templatized configuration

  1. Create the templatized configlet yaml and the configlet data value yaml for key:value pairs.

  2. Apply the configuration using the kubectl apply command, starting with the config data value yaml.

  3. Check on the configlet.

    When a configlet resource is deployed, it creates additional node configlet custom resources, one for each node matched by the crpdSelector.

    If the configuration defined in the configlet yaml is invalid or fails to deploy, you can view the error message using kubectl describe for the node configlet custom resource.

    For example:

    The following output has been trimmed for brevity:

  4. Optionally, verify the configuration on the Access cRPD CLI shell in CLI mode. Note that the configuration is applied as a configuration group named after the configlet resource.

Modifying the Configlet

You can modify a configlet resource by changing the yaml file and reapplying it using the kubectl apply command.

Any changes to existing configlet resource are reconciled by replacing the configuration group on cRPD.

You can delete the configuration group by deleting the configlet resource using the kubectl delete command.

Troubleshooting

If you run into problems, check the contrail-k8s-deployer logs. For example: