Cisco Prime Network Registrar on Kubernetes

Kubernetes is an open source container orchestration system for automating software deployment, scaling, and management. Starting from Cisco Prime Network Registrar 11.1, you can deploy the Cisco Prime Network Registrar instances on Kubernetes using the following Docker images:

  • For regional instance deployment: cpnr-regional-11.1-1.el8.x86_64_rhel_docker.tar.gz

  • For local instance deployment: cpnr-local-11.1-1.el8.x86_64_rhel_docker.tar.gz


Note


The names of the images will change with releases in future.


You need to have a private docker registry in Kubernetes to load the container image.

This chapter contains the following section:

Deploying Cisco Prime Network Registrar Instance on Kubernetes

You can deploy the Cisco Prime Network Registrar instances on Kubernetes using the YAML files. YAML is the standard format used in a Kubernetes configuration file. Cisco Prime Network Registrar kit cpnr-11.1-1.el8.x86_64_kubernetes.tar.gz contains examples of YAML files (cpnr-local-statefulset.yaml and cpnr-regional-statefulset.yaml), which depict one of the ways of deploying Cisco Prime Network Registrar on Kubernetes.


Note


No special license is required to deploy Cisco Prime Network Registrar in the Kubernetes environment. It uses the existing container licenses.


For example, you can use the cpnr-local-statefulset.yaml in the Cisco Prime Network Registrar kit to create the Cisco Prime Network Registrar local instance on Kubernetes. This configuration uses StatefulSet and hostNetwork deployment. Instance created using this YAML will bind the Cisco Prime Network Registrar local instance to the configured worker node. This instance will run only on the configured worker node and it will not run on the other node.

When a pod is configured with hostNetwork: true, the applications running in the pod can directly see the network interfaces of the host machine where the pod was started. An application that is configured to listen on all network interfaces will in turn be accessible on all the network interfaces of the host machine.

YAML file consists of the following Kubernetes resources:

  • Service

    In cpnr-local-statefulset.yaml, cpnr-local is the service name and since Headless service is used, the clusterIp is set to None.

  • StatefulSet

    In cpnr-local-statefulset.yaml, cpnr-local is the StatefulSet name and is used to run the Cisco Prime Network Registrar 11.1 docker image with replica of one.

    StatefulSet is used in Cisco Prime Network Registrar for two reasons:

    • Constant pod names

    • When pods created using deployment are deleted, it creates a new pod before the old pod is completely terminated. Since hostNetwork is used before the old Cisco Prime Network Registrar process on the host node is termianted completely, the new Cisco Prime Network Registrar pod is created and the Cisco Prime Network Registrar services on the new pod is down since the Cisco Prime Network Registrar process on the old pod is not termianted completely.

      This is overcome by StatefulSet where the old pod is terminated completely and only then the new pod is created.


Note


Cisco Prime Network Registrar has been tested using the hostNetwork, as other networking modes had issues with HA and failover pair. In the hostNetwork mode, when a pod starts, it uses the host network namespace and host IP address. This basically means that the pod can see all the network interfaces of the host. With hostNetwork mode, only one Cisco Prime Network Registrar instance can be deployed in a node and hence the replica in the YAML is set to 1. If multiple Cisco Prime Network Registrar pods are to be deployed in the same node using hostNetwork mode, then for each pod, you need to change all Cisco Prime Network Registrar related ports and adjust the replicas accordingly. However, this may not be useful.


Procedure


Step 1

Configure the following parameters in the YAML file:

  • NODE_NAME: Worker node name, where the Cisco Prime Network Registrar instance will run. For example, “cnr-k8s-worker2.server.com”. Use the kubectl get nodes command to get the node name.

  • IMAGE: The Docker image location. For example “cnr-k8s-worker1.server.com/cpnr-local:11.1”, where cnr-k8s-worker1.server.com is the private registry and the image name is cpnr-local with tag 11.1.

  • HOST_MOUNT_PATH: Directory path on the host machine. This directory will be used to store configuration files and data on the Cisco Prime Network Registrar instance. /var/nwreg2 of the pod is mapped to HOST_MOUNT_PATH in the host machine. This is required to persist the data ofCisco Prime Network Registrar instance on the host machines.

Step 2

Create the Cisco Prime Network Registrar instance on Kubernetes using the following command:

  • For Cisco Prime Network Registrar local instance deployment:

    # kubectl create -f cpnr-local-statefulset.yaml
  • For Cisco Prime Network Registrar regional instance deployment:

    # kubectl create -f cpnr-regional-statefulset.yaml

Step 3

Check the Cisco Prime Network Registrar instance details on Kubernetes using the following command:

# kubectl get all

Step 4

Log into the Cisco Prime Network Registrar instance pod using the following command:

# kubectl exec -it <pod name> -- bash
For example:
# kubectl exec -it cpnr-dhcp-dns-0 -- bash
# /opt/nwreg2/local/usrbin/nrcmd -s
100 Ok

Step 5

Set the user name and password, and register the local pods to regional pods.


If you want to delete the Cisco Prime Network Registrar instance on Kubernetes, use the following command:

  • For Cisco Prime Network Registrar local instance:

    # kubectl delete -f cpnr-local-statefulset.yaml
  • For Cisco Prime Network Registrar regional instance:

    # kubectl delete -f cpnr-regional-statefulset.yaml

To debug any pod failures, use the kubectl logs podname or kubectl describe pod podname command.


Note


If you want to deploy Cisco Prime Network Registrar pod in another worker node, you need to make changes in the YAML file (for example, you need to change service.metadata.name and statefulset.metadata.name.).



Note


Cisco Prime Network Registrar 11.1 Docker images have been tested with Kubernetes version 1.23.5. CNI used is Calico 3.22.0. The entire testing is carried out using the YAML files provided as examples. If you want to change the YAML file, it is your responsibility to test it before moving it to production.