Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

external-header-nav
keyboard_arrow_up
close
keyboard_arrow_left
Address Pool Manager Installation Guide
Table of Contents Expand all
list Table of Contents

How to Use Command Line Tools to Administer APM

date_range 05-Dec-24

After you've installed the Address Pool Manager (APM) application, you can perform the following administration functions.

Address Pool Manager gives you two command line options for perform administrator tasks. You can either use the APM utility script (apm) or the Kubernetes Command Line tool to administer APM.

Access APM Utility Commands

Use the APM utility commands to perform administration functions.

You can use the APM utility script (apm) to administer the application and to access the CLI that you use to configure the address management functions. The Juniper APM installation places the utility script in /var/local/apm and creates a symbolic link to the script in /usr/local/bin/apm.

You can use the apm utility script (which uses the Kubernetes command line tool and Helm commands ) to do the following:

  • Create and delete objects.
  • Provide log access.
  • Conduct interactive sessions with pod containers.
  • Display the status of the APM objects.

Using the apm utility script simplifies many of your administrative duties. The script performs the tasks you need to manage APM, while masking the complexity of the kubectl command.

Table 1 lists the commands that you can invoke with the apm utility script and describes the action that occurs. Many of the individual commands have options that you can specify.

Table 1: APM Utility Script Commands
Name Action
clean Clean up unneeded releases and/or docker cache. To run this command, you need sudo privileges.
Note:

Introduced in Release 3.2.

cli Access the CLI that you can use to configure APM features and to monitor the current status for managed BNGs.
contexts Display the available cluster contexts for control with APM
Note:

Introduced in Release 3.2.

db-info Displays current state of APM’s database microservice including the current version, stateful set pods, and their roles.
Note:

Introduced in Release 3.2.

db-switchover Forces the persistent state database (DB) primary pod to switchover to an eligible backup pod. To run this command, you need sudo privileges. Introduced in Release 3.2.
Note:

DB switchover is a service disrupting event and you only use it with the upgrade procedure.

ip Displays the IP addresses of Address Pool Manager.
Note:

Introduced in Release 3.2.

link Links a cluster to a specific software version.
Note:

Introduced in Release 3.2.

logs Display APM logs.
rename-context Rename a context. Does not effect the running Address Pool Manager on the cluster. To run this command, you need sudo privileges.
Note:

Introduced in Release 3.2.

restart Restart one or more specified services. To run this command, you need sudo privileges.
Note:

Introduced in Release 3.1.

rollout Upgrade or start an APM service. To run this command, you need sudo privileges.
Note:

Introduced in Release 3.2.

save-config Saves the current configuration of the Address Pool Manager to a file outside the pod. To run this command, you need sudo privileges.
Note:

Introduced in Release 3.2.

shell Connect to a running APM microservice. To run this command, you need sudo privileges.
setup Set up the APM application as part of the installation process. To run this command, you need sudo privileges.
start Start all APM services. To run this command, you need sudo privileges.
status Display the current status of the APM services. To run this command, you need sudo root privileges.
storage

Provides the status of the storage drivers for APM.

Note:

Introduced in Release 3.2.

stop Stop all APM services. To run this command, you need sudo privileges.
unlink Unlink components associated with the context. To run this command, you need sudo privileges.
Note:

Introduced in Release 3.2.

version Displays the version of every running microservice in the APM instance as well as the APM utility. It also lists all available APM software releases on the system.

Use the following general syntax to issue a command:

  • For a short option:

    content_copy zoom_out_map
    $ apm command-name -option
  • For a long option:

    content_copy zoom_out_map
    $ apm command-name ––option

To target a command at a particular cluster context, use the context option.

content_copy zoom_out_map
$ apm command-name --context context-name

To display a list of available commands with a brief description, use either the h or help option:

content_copy zoom_out_map
$ apm -h
content_copy zoom_out_map
$ apm --help

To display the options for a specific command:

content_copy zoom_out_map
$ apm command-name -h

To specify the --no-color option to disable colored-text output (used to distinguish logs from different microservices):

content_copy zoom_out_map
$ apm command-name --nocolor

Upgrade APM to a New Version Using the APM installation Utility

Use this procedure to upgrade to a new version of APM which is installed on a cluster that was created by the BBE Cloudsetup utility or by Red Hat OpenShift Container Platform Console. This procedure assumes APM is running on your system.

  1. Download the APM software package from the Juniper Networks software download page to the jump host.

    APM is available as a compressed tarball image (.tgz). The filename includes the release number as part of the name. The release number has the format: <Major>.<Minor>.<Maintenance>

    • major is the main release number of the product.
    • minor is the minor release number of the product.
    • maintenance is the revision number.
  2. Unpack the APM tarball (.tgz) file on the jump host by entering:
    content_copy zoom_out_map
    $ tar -zxvf apm-m.m.m.tgz 
    apm/
    apm/apm_loader
    apm/images/
    apm/images/apm_containerImages.tar.gz
    apm/charts/
    apm/charts/provman/
    apm/charts/provman/templates/
    apm/charts/provman/templates/apmProv-man.yaml
    apm/charts/provman/templates/apmApmiSvc.yaml
    apm/charts/provman/questions.yaml
    apm/charts/provman/Chart.yaml
    apm/charts/provman/containers.yaml
    apm/charts/provman/values.yaml
    apm/charts/provman/.helmignore
    apm/charts/entman/
    apm/charts/entman/templates/
    apm/charts/entman/templates/apmEnt-man.yaml
    .
    .
    .
    
  3. Run the loader script after you unpack the tarball.
    content_copy zoom_out_map
    $ sudo apm/apm_loader
    Creating apm group... done.
    Loading files... done.
    Updating latest link... done
    Setting up utility script... done.
    Updating wrapper... done
    Successfully loaded: 3.3.0
    
  4. Link to the cluster by using the link command. The link command associates the loaded APM software package to the cluster in preparation for the setup.
    content_copy zoom_out_map
    $ sudo -E apm link --context context-name --version apm-version
    Linking contextName to 3.3.0 ... done.
    Linking complete, please run apm setup.
    
    • context-name is the Kubernetes context (cluster name).

    • apm-version is the software version.

  5. If you are upgrading APM on a Red Hat OpenShift Container Platform cluster, log in with the OpenShift CLI and then proceed to the next step.
    If you are installing APM on a BBE Cloudsetup created cluster, proceed to the next step.
  6. You must authenticate with the container registry in order to be able to push the APM container images. How you authenticate to the registry varies depending on if you are installing APM on a BBE Cloudsetup created cluster or on an Red Hat OpenShift Container Platform cluster (see the respective documentation for details).
  7. Run setup to complete any additional environment values.
    content_copy zoom_out_map
    $ sudo -E apm setup –-context context-name --update
    • context-name is the Kubernetes context (cluster names).

    • update are the prompts for only missing values (primarily used after loading a new software release).

  8. Display the running DB to see which pod is the primary pod and to determine whether to upgrade the persistent state database (DB):
    content_copy zoom_out_map
    apm db-info –context myCluster
    Version: 6.2.13
    Primary: jnpr-apm-redis-1
    Backup(s): jnpr-apm-redis-0
  9. Display the DB version in the new package:
    content_copy zoom_out_map
    apm version --compare 3.3.0 –-context myCluster
    components:
    apm: 3.2.2-2 -> 3.3.0
    addrman: 3.2.2-2 -> 3.3.0
    entman: 3.2.2-2 -> 3.3.0
    mgmt: 3.2.2-2 -> 3.3.0
    provman: 3.2.2-2 -> 3.3.0 
    redis: 6.2.13 -> 6.2.14-debian-12-r21
    Note:

    For example, the DB version 6.2.14-debian-12-r21 is later than what is running (6.2.13), so you need to upgrade the DB.

  10. Initiate a DB switchover if the jnpr-apm-redis-0 is not the primary DB.
    content_copy zoom_out_map
    sudo -E apm db-switchover –-context context-name 
  11. Rollout the new DB version.
    content_copy zoom_out_map
    sudo -E apm rollout –-context context-name -–service redis --version 3.3.0
  12. Upgrade the microservices with the sudo -E apm rollout –-context context-name –service service-name --version software-version command. Enter the commands in the following order:
    content_copy zoom_out_map
    sudo -E apm rollout –-context context-name -–service mgmt --version 3.3.0 
    content_copy zoom_out_map
    sudo -E apm rollout –-context context-name -–service addrman --version 3.3.0 
    content_copy zoom_out_map
    sudo -E apm rollout –-context context-name -–service entman --version 3.3.0 
    content_copy zoom_out_map
    sudo -E apm rollout –-context context-name -–service provman --version 3.3.0 
  13. Verify that all microservices are running the new version of software:
    content_copy zoom_out_map
    $ apm version --context context-name --detail
    Address_Pool_Manager versions:
      Microservice  Release            (version)                    
      apm:          3.3.0                              
      addrman:      3.3.0                              
      entman:       3.3.0                               
      mgmt:         3.3.0 (24.2R2)
      provman:      3.3.0                               
      redis:        3.3.0  (6.2.14-debian-12-r21)

Upgrade APM to a New Version Without Using the APM Utility

The instructions in this section describes the upgrade steps for installing APM on a preexisting Kubernetes cluster of your choice. This process is a manual process and does not use the APM utility that comes with the APM installation package.

  1. Download the APM software package from the Juniper Networks software download page to the jump host.

    APM is available as a compressed tarball image (.tgz). The filename includes the release number as part of the name. The release number has the format: <Major>.<Minor>.<Maintenance>

    • major is the main release number of the product.
    • minor is the minor release number of the product.
    • maintainance is the revision number.
  2. Unpack the APM tarball (.tgz) file on the jump host by entering:
    content_copy zoom_out_map
    $ tar -zxvf apm-m.m.m.tgz 
    apm/
    apm/apm_loader
    apm/images/
    apm/images/apm_containerImages.tar.gz
    apm/charts/
    apm/charts/provman/
    apm/charts/provman/templates/
    apm/charts/provman/templates/apmProv-man.yaml
    apm/charts/provman/templates/apmApmiSvc.yaml
    apm/charts/provman/questions.yaml
    apm/charts/provman/Chart.yaml
    apm/charts/provman/containers.yaml
    apm/charts/provman/values.yaml
    apm/charts/provman/.helmignore
    apm/charts/entman/
    apm/charts/entman/templates/
    apm/charts/entman/templates/apmEnt-man.yaml
    .
    .
    .
    
  3. The container images needed by APM are stores in the images subdirectory. You must push the images to the registry where the scheduled application images will be pulled from. Depending on the type of container registry being used the commands may be different. The following commands illustrate one method of pushing container images to the registry:
    content_copy zoom_out_map
    % docker image load -i ./images/apm_addr-man_containerImages.tar.gz
    Loaded image: apm_addr-man:3.3.0
    content_copy zoom_out_map
    % docker tag apm_addr-man:3.3.0 <regHost>:<regPort>/apm_addr-man:3.3.0
    content_copy zoom_out_map
    % docker push <regHost>:<regPort>/apm_addr-man:3.3.0
    
  4. To prepare APM for upgrade, create a new YAML configuration file for each microservice. (Table 3 describes the fields in the microservice's configuration files.)
    Note:

    You may have create a single values.yaml, during your intial installation,that contains information for all the microservices. The single values.yaml is located under the umbrella chart in the apm/apm/charts/address_pool_manager folder. The procedures in this section only describe how to upgrade if created individual YAML configuration files for each microservice.

    Create a new values.yaml file for each of the microservices, by making a copy of the file and then saving the new file. Update each file according to your Kubernetes cluster's information.
    Following are the microservices and their values.yaml file location:
    • redis microservice—Located at apm/apm/charts/redis

    • mgmt microservice—Located at apm/apm/charts/mgmt

    • addrman microservice—Located at apm/apm/charts/addrman

    • entman microservice—Located at apm/apm/charts/entman.

    • provman microservice—Located at apm/apm/charts/provman

  5. Run the dependency update command:
    content_copy zoom_out_map
    helm dependency update --kube-context context-name --namespace jnpr-apm ./charts/redis/
  6. After you have made all the desired changes to your new values.yaml files for each microservice, the microservices must be deployed with the new values.yaml files.

    Run the following commands:

    content_copy zoom_out_map
    helm upgrade --dependency-update --kube-context context-name --namespace jnpr-apm --create-namespace --atomic --install -f ./charts/redis/new-values.yaml redis ./charts/redis
    content_copy zoom_out_map
    helm upgrade --dependency-update --kube-context context-name --namespace jnpr-apm --create-namespace --atomic --install -f ./charts/mgmt/new-values.yaml mgmt ./charts/mgmt
    content_copy zoom_out_map
    helm upgrade --dependency-update --kube-context context-name --namespace jnpr-apm --create-namespace --atomic --install -f ./charts/addrman/new-values.yaml addrman ./charts/addrman
    content_copy zoom_out_map
    helm upgrade --dependency-update --kube-context context-name --namespace jnpr-apm --create-namespace --atomic --install -f ./charts/entman/new-values.yaml entman ./charts/entman
    content_copy zoom_out_map
    helm upgrade --dependency-update --kube-context context-name --namespace jnpr-apm --create-namespace --atomic --install -f ./charts/provman/new-values.yaml provman ./charts/provman
  7. Verify the APM installation by running the Kubernetes Command Line Tool command kubectl get pods and verify the APM pods are running.
    content_copy zoom_out_map
    $ kubectl get pods -n jnpr-apm -o wide 
    NAME                                READY   STATUS    RESTARTS   AGE    IP            NODE                          NOMINATED NODE   READINESS GATES
    jnpr-apm-addrman-7cff87b557-gp8s7   1/1     Running   0          124m   10.42.2.15    jib.englab.juniper.net        <none>           <none>
    jnpr-apm-entman-67d9bf9498-bx8jj    1/1     Running   0          124m   10.42.1.141   keel.englab.juniper.net       <none>           <none>
    jnpr-apm-mgmt-6c76cc8dd7-pmlpv      1/1     Running   0          124m   10.42.0.20    binnacle.englab.juniper.net   <none>           <none>
    jnpr-apm-provman-75bc8d465d-czcfm   1/1     Running   0          123m   10.42.0.22    binnacle.englab.juniper.net   <none>           <none>
    jnpr-apm-redis-0                    1/1     Running   0          124m   10.42.2.16    jib.englab.juniper.net        <none>           <none>
    jnpr-apm-redis-1                    1/1     Running   0          123m   10.42.0.21    binnacle.englab.juniper.net   <none>           <none>
    jnpr-apm-redis-sentinels-0          1/1     Running   0          124m   10.42.0.19    binnacle.englab.juniper.net   <none>           <none>
    jnpr-apm-redis-sentinels-1          1/1     Running   0          124m   10.42.1.142   keel.englab.juniper.net       <none>           <none>
    jnpr-apm-redis-sentinels-2          1/1     Running   0          124m   10.42.2.17    jib.englab.juniper.net        <none>           <none>
    
  8. Verify that the services are present. Run the Kubernetes Command Line Tool command kubectl get services.
    content_copy zoom_out_map
    $ kubectl get services -n jnpr-apm
    NAME                             TYPE           CLUSTER-IP      EXTERNAL-IP      PORT(S)           AGE
    jnpr-apm-mgmt-svc                ClusterIP      10.43.131.131   <none>           8066/TCP          125m
    jnpr-apm-redis-sentinels-0-svc   ClusterIP      10.43.142.53    <none>           7381/TCP          125m
    jnpr-apm-redis-sentinels-1-svc   ClusterIP      10.43.109.206   <none>           7381/TCP          125m
    jnpr-apm-redis-sentinels-2-svc   ClusterIP      10.43.104.100   <none>           7381/TCP          125m
    jnpr-apm-redis-svc               ClusterIP      10.43.6.207     <none>           7380/TCP          125m
    provman-apmi                     LoadBalancer   10.43.221.12    198.19.224.212   20557:32553/TCP   125m
    

Start or Stop APM Services Using the APM Utility

Use the apm utility script to start or stop all APM services. The services start in order of dependency. Essential services (db and mgmt) start first, followed by the other services. The services stop in reverse order of dependency.

  • To start all APM services:

    content_copy zoom_out_map
    $ sudo -E apm start --context context-name 
    Note:

    We recommend that you use the sudo -E apm start ––services option to start individual services or a set of services only for troubleshooting. Use under the guidance of a Juniper Networks support representative. Use with caution as this command is like rebooting to factory-default.

    Note:

    APM starts from it's initial settings when you execute the apm setup command. Any persistent state is lost when the apm stop command is executed. The current configuration can be saved using the apm save-config command. The saved configuration is the configuration that is used the next time APM is started.

  • To stop all APM services:

    content_copy zoom_out_map
    $ sudo -E apm stop --context context-name
    WARNING Shutting down your Address Pool Manager will reset it to factory defaults and you will lose all state on the system.
     
    Shutdown will begin in 2 minutes. Please use CTRL+C to cancel.
    

Restart APM Services Using the Kubernetes Command Line Tool

Use the kubectl delete pods Kubernetes command to restart APM services. For example:

content_copy zoom_out_map
$ kubectl delete pod -n jnpr-apm jnpr-apm-addrman-758cc8885
pod "jnpr-apm-addrman-7585cc8885" deleted
Note:

To determine the pod name, you can use the kubectl get pods -n jnpr-apm Kubernetes command (see Check the Status of APM Services Using the Kubernetes Command Line Tool).

Setup Secrets Using the APM Utility

You can setup secrets during setup or run the sudo -E apm setup --context context-name --secrets to setup secrets or update them.

content_copy zoom_out_map
$ sudo -E apm setup --context context-name --secrets
APMi Secret Name (deployed: ) > 
APMi certificate (default: ) > ./apm.crt
Copied /home/user/apm.crt to /var/local/apm/e476597324/secrets/apmi with 600 permissions
APMi private key (default: ) > ./apm.key
Copied /home/user/apm.keyto /var/local/apm/e476597324/secrets/apmi with 600 permissions
APMi root certificate (default: ) > ./rootCA.crt
Copied /home/user/rootCA.crt to /var/local/apm/e476597324/secrets/apmi with 600 permissions
Note:

If you enter a value for the secret name, you will not be asked for the key or certification files.

Display Database Information Using the APM Utility

The apm db-info command displays current state of APM’s database microservice including the current version, stateful set pods, and their roles.

apm db-info [--context context-name] [-o|--output json]

content_copy zoom_out_map
$ apm db-info  [--context context-name] [-o|--output json]
Version: 6.2.13
Primary: jnpr-apm-redis-0
Backup(s): jnpr-apm-redis-1

Display the Running Database Using the Kubernetes Command Line Tool

Use the kubectl exec Kubernetes command to display the running database (DB) to see which pod is the primary pod and to determine whether to upgrade the persistent state database. You should run the kubectl exec on both the primary and secondary redis server instances. For example:

content_copy zoom_out_map
$ kubectl exec -i -n jnpr-apm jnpr-apm-redis-0 -- redis-cli -p 7380 role
master
174738135
10.42.1.152
7380
174738135$
content_copy zoom_out_map
$ kubectl exec -i -n jnpr-apm jnpr-apm-redis-1 -- redis-cli -p 7380 role
slave
10.42.2.22
7380
connected
174740637

Perform a Database Switchover Using the Kubernetes Command Line Tool

To force the persistent state database (DB) primary pod to switchover to an eligible backup pod, perform the following:

  1. Run the kubectl get pods Kubernetes command to determine the name of the sentinel pods.
    content_copy zoom_out_map
    $ kubectl get pods -n jnpr-apm                                                                                                                                                                                                                                                             
    NAME                                READY   STATUS    RESTARTS   AGE                                                                                                                                                                                                                                                
    jnpr-apm-addrman-7585cc8885-5xr24   1/1     Running   0          5m28s                                                                                                                                                                                                                                              
    jnpr-apm-entman-5dcf659676-4mq6g    1/1     Running   0          5d22h                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
    jnpr-apm-mgmt-6d7c4f47dc-2v8ss      1/1     Running   0          5d22h                                                                                                                                                                                                                                              
    jnpr-apm-provman-65c66bc689-bvhb6   1/1     Running   0          5d22h                                                                                                                                                                                                                                              
    jnpr-apm-redis-0                    1/1     Running   0          5d22h                                                                                                                                                                                                                                              
    jnpr-apm-redis-1                    1/1     Running   0          5d22h                                                                                                                                                                                                                                              
    jnpr-apm-redis-sentinels-0          1/1     Running   0          5d22h                                                                                                                                                                                                                                              
    jnpr-apm-redis-sentinels-1          1/1     Running   0          5d22h                                                                                                                                                                                                                                              
    jnpr-apm-redis-sentinels-2          1/1     Running   0          5d22h
  2. Pick any of the three sentinel pods to use with the kubectl exec command. The following example uses the jnpr-apm-redis-sentinels-0 sentinel pod. After running following commands, the roles of the redis instances are reveresed (redis-0 is the secondary and redis-1 is the primary).
    content_copy zoom_out_map
    $ kubectl exec -i -n jnpr-apm jnpr-apm-redis-sentinels-0 -c redis-sentinel -- redis-cli -p 7381 sentinel failover jnpr-apm-redis-masters                                                                                                                                                   
    OK                                                                                                                                                                                                                                                                                                                  
    
    content_copy zoom_out_map
    $ kubectl exec -i -n jnpr-apm jnpr-apm-redis-0 -- redis-cli -p 7380 role                                                                                                                                                                                                                   
    slave

Check the Status of APM Services Using the APM Utility

Use the apm status utility script to check the status of each APM service (functional component) listed in Table 2. The status shows whether a service is running, has exited, or has not started. It also displays the service name on the Kubernetes pod. You can compare uptime for the services to quickly see whether any service has been restarted.

Table 2: Services Displayed with the status Command

Microservice

Pod Prefix

addrman—Address manager

jnpr-apm-addrman

mgmt—CLI management

jnpr-apm-mgmt

redis (Remote Dictionary Server)—consists of a set of pods which provide the persistent database.

jnpr-apm-redis

entman—Entity manager

jnpr-apm-entman

provman—Provisioning manager

jnpr-apm-provman

To check the status:

  1. Display the service status.
    content_copy zoom_out_map
    $ apm status --context contextName [-o|--output json] [--detail]
  2. (Optional) Render the version information in JavaScript Object Notation (JSON) format, which is useful for scripting interfaces.
    content_copy zoom_out_map
    $ apm status [-o|--output json]

For example:

content_copy zoom_out_map
$ apm status --context context-name --detail
MICROSERVICE  POD                                STATE    RESTARTS  UPTIME                    NODE                            
addrman       jnpr-apm-addrman-7b778979b6-5vk44  Running  0         11 days, 23:25:14.629150  test-node-1
mgmt          jnpr-apm-mgmt-6b4cf98d4d-hmjd9     Running  0         11 days, 23:25:33.629206  test-node-1
entman        jnpr-apm-entman-7d66d89d6b-5295d   Running  0         11 days, 23:25:14.629224  test-node-1
provman       jnpr-apm-provman-849fb9cc4-vswm6   Running  0         11 days, 22:50:05.629258  test-node-1
redis         jnpr-apm-redis-0                   Running  0         11 days, 23:25:36.629275  test-node-1
redis         jnpr-apm-redis-1                   Running  0         11 days, 23:25:23.629290  test-node-1
redis         jnpr-apm-redis-sentinels-0         Running  0         11 days, 23:25:26.629306  test-node-1
redis         jnpr-apm-redis-sentinels-1         Running  0         11 days, 23:25:26.629322  test-node-1
redis         jnpr-apm-redis-sentinels-2         Running  0         11 days, 23:25:26.629337  test-node-1

Storage: Healthy
content_copy zoom_out_map
$ apm status --context context-name 
MICROSERVICE PODS RESTARTS
addrman 1/1 0
mgmt 2/2 0/0
entman 1/1 0
provman 1/1 0
redis 5/5 0/0/0/0/0

Storage: Healthy

Check the Status of APM Services Using the Kubernetes Command Line Tool

Use the Kubernetes Command Line tool to check the status of each APM service (functional component) listed in Table 2. The status shows whether a service is running, has exited, or has not started. It also displays the service name on the Kubernetes pod. You can compare uptime for the services to quickly see whether any service has been restarted.

Table 3: Services Displayed with the status Command

Microservice

Pod Prefix

addrman—Address manager

jnpr-apm-addrman

mgmt—CLI management

jnpr-apm-mgmt

redis (Remote Dictionary Server)—consists of a set of pods which provide the persistent database.

jnpr-apm-redis

entman—Entity manager

jnpr-apm-entman

provman—Provisioning manager

jnpr-apm-provman

To check the status, run the following command:

content_copy zoom_out_map
$ kubectl get pods -n jnpr-apm -o wide

For example:

content_copy zoom_out_map
$ kubectl get pods -n jnpr-apm -o wide
NAME                                READY   STATUS    RESTARTS   AGE     IP            NODE                          NOMINATED NODE   READINESS GATES
jnpr-apm-addrman-7585cc8885-5xr24   1/1     Running   0          11m     10.42.0.31    binnacle.englab.juniper.net   <none>           <none>
jnpr-apm-entman-5dcf659676-4mq6g    1/1     Running   0          5d22h   10.42.2.24    jib.englab.juniper.net        <none>           <none>
jnpr-apm-mgmt-6d7c4f47dc-2v8ss      1/1     Running   0          5d22h   10.42.0.30    binnacle.englab.juniper.net   <none>           <none>
jnpr-apm-provman-65c66bc689-bvhb6   1/1     Running   0          5d22h   10.42.1.153   keel.englab.juniper.net       <none>           <none>
jnpr-apm-redis-0                    1/1     Running   0          5d22h   10.42.2.22    jib.englab.juniper.net        <none>           <none>
jnpr-apm-redis-1                    1/1     Running   0          5d22h   10.42.1.152   keel.englab.juniper.net       <none>           <none>
jnpr-apm-redis-sentinels-0          1/1     Running   0          5d22h   10.42.1.151   keel.englab.juniper.net       <none>           <none>
jnpr-apm-redis-sentinels-1          1/1     Running   0          5d22h   10.42.0.28    binnacle.englab.juniper.net   <none>           <none>
jnpr-apm-redis-sentinels-2          1/1     Running   0          5d22h   10.42.2.23    jib.englab.juniper.net        <none>           <none>

Display APM IP Addresses Using the APM Utility

Use the apm ip utility script to display the Kubernetes objects that are necessary for the orchestration of the APM pods. For example:

content_copy zoom_out_map
$ apm ip --context context-name --detail
SERVICE                         MICROSERVICE  EXTERNAL IP     INTERNAL IP    PORT(S)
apm-ssh                         mgmt          198.19.224.215  10.43.35.110   22     
jnpr-apm-mgmt-svc               mgmt                          10.43.131.131  8066   
jnpr-apm-redis-sentinels-0-svc  redis                         10.43.142.53   7381   
jnpr-apm-redis-sentinels-1-svc  redis                         10.43.109.206  7381   
jnpr-apm-redis-sentinels-2-svc  redis                         10.43.104.100  7381   
jnpr-apm-redis-svc              redis                         10.43.6.207    7380   
provman-apmi                    provman       198.19.224.212  10.43.221.12   20557  

Display the APM IP Addresses Using the Kubernetes Command Line Tool

Use the kubectl get services Kubernetes command to display the Kubernetes objects that are necessary for the orchestration of the APM pods. For example:

content_copy zoom_out_map
$ kubectl get services -n jnpr-apm | egrep "TYPE|LoadBalancer"
NAME                             TYPE           CLUSTER-IP      EXTERNAL-IP      PORT(S)           AGE
apm-apmi                         LoadBalancer   10.43.99.79     198.19.224.212   20557:32136/TCP   5d22h
apm-ssh                          LoadBalancer   10.43.35.110    198.19.224.215   22:30261/TCP      146d 

Display Logging Using the APM Utility

Use the apm logs utility script to display the logs of events that occur while APM is running. You can also use the BBE Event Collection and Visualization utility to display file-based logs collected and stored since the time APM is started. BBE Event Collection and Visualization is a cloud-based centralized utility that provides a way to capture APM logs that span the life-cycle of APM micro-services. You link to the BBE Event Collection and Visualization logging utility when you set up APM. See the Broadband Edge Event Collection and Visualization Installation Guide.

Display APM Logging

BBE Event Collection and Visualization is a cloud-based centralized utility that provides a way to capture APM logs that span the life-cycle of APM micro-services. If you have BBE Event Collection and Visualization setup, during the APM setup, you can point BBE Event Collection and Visualization to perform the logging. BBE Event Collection and Visualization has a web-based interface to OpenSearch’s capabilities for advanced searching, aggregation, viewing, and data analysis of collected syslog events.

Use the apm logs utility script to display the logs of events that occur while APM is running. The event logs include events such as those shown in the following non-exhaustive list:

  • Pool-domain registration events

  • Address allocation failures

  • Network entity connection failures

  • Startup messages

  • Network entity resynchronization events

  • Pool and partition utilization threshold and depletion warnings

By default, APM sends logs to the standard output (stdout) of the service. The output displays the circular buffer of all services or of a specified service. You can also enable logging to follow the log output of the running services. Following the log output creates an open session that continuously streams the logs to stdout.

The APM logging functions mask the underlying complexities of the kubectl log command that is collecting the log information. You can still use the kubectl log command, but that is outside the scope of this documentation.

Note:

You can use third-party applications to capture and redirect the stdout stream for the container. Refer to your third-party documentation for assistance. You can also configure Docker with different logging drivers to redirect stdout. Refer to your Docker documentation for assistance.

To display APM logs for all services:

content_copy zoom_out_map
$ apm logs [--context contextName] [-f] [--previous] [--services SERVICES [SERVICES ...]] [--logset LOGSET] [--nocolor]
Best Practice:

Use the apm logs ––services option only when you are troubleshooting under the guidance of a Juniper Networks support representative.

To follow the logs for all services, specify the follow option (-f):

content_copy zoom_out_map
$ apm logs -f

To view logs from previous instances of the containers in a Kubernetes pod, specify the previous container option (-p):

content_copy zoom_out_map
$ apm logs -p

You can use standard Ubuntu conventions to redirect the logs to a file or to the terminal and to a file. Refer to the Ubuntu documentation for more information, but you can use the following examples as a starting point:

  • Redirect all logs to only a file.

    content_copy zoom_out_map
    $ apm logs > file-path
  • Redirect all logs to both the screen and to a file.

    content_copy zoom_out_map
    $ apm logs | tee file-path
Best Practice:

Use the ––services option only for troubleshooting under the guidance of a Juniper Networks support representative.

You can specify any of the following severity levels, in order of increasing severity:

Table 4: Severity Level
Severity Level Description
debug Detailed information that is typically of interest only when you are trying to diagnose a problem. These logs are often very frequent.
info Events or non-error conditions of interest. Logs at this level provide confirmation that everything is working as expected. These logs are generally not very frequent.
warning Indicates that something unexpected happened or that some problem might occur in the near future. A simple example of the latter is the disk space low warning that indicates that you might run out of disk space soon. In either case, the software is still working as expected, but you might want to monitor it more closely. These logs are generally not very frequent.
error Indicates that a more serious problem has prevented the software from performing some function, but the software has handled the problem as gracefully as possible to continue functioning.
critical A serious error that indicates that the program itself might be unable to continue running.

You can use the --logset option to display logs either for only APM services or for only prebuilt services. If you do not use this option, then only the APM services logs are displayed.

To display logs for only APM services:

content_copy zoom_out_map
$ apm logs ––logset apm
$ apm logs

To display logs for prebuilt services:

content_copy zoom_out_map
$ apm logs ––logset apm-infra

Prebuilt services are services borrowed from other sources to provide infrastructure functions for APM. These sources include MGMT, redis, and redis-sentinel. For example, redis provides database and messaging services, MGMT provides a configuration/CLI service, and so on.

Display Logs Using the Kubernetes Command Line Tool

To display all the logs of events that occur while APM is running, run the following command:

content_copy zoom_out_map
$ kubectl logs -n jnpr-apm -l jnpr/logset=jnpr-apm --tail=-1
 

To display logs for a specific microservice, replace the label selector (-l jnpr/logset=jnpr-apm) with the pod name. For example:

content_copy zoom_out_map
$ kubectl logs -n jnpr-apm microservice-pod-name --tail=-1
 
Note:

To determine the pod name, you can use the kubectl get pods -n jnpr-apm Kubernetes command (see Check the Status of APM Services Using the Kubernetes Command Line Tool).

Determine the APM Version Using the APM Utility

Use the apm version [--context <context name>] [-o|--output json] [--detail| --compare <software-version>] utility script to determine the version number of the installed APM release.

To display the release version:

content_copy zoom_out_map
$ apm version --context contextName --detail 
Address_Pool_Manager versions:
  Microservice  Release            (version)                    
  apm:          3.3.0                              
  addrman:      3.3.0                              
  entman:       3.3.0                               
  mgmt:         3.3.0 (24.2R2)
  provman:      3.3.0                               
  redis:        3.3.0  (6.2.14-debian-12-r21)

To compare the specified software release versions against the current deployed release for the specified context:

content_copy zoom_out_map
apm version --compare 3.2.1 –-context myCluster
components:
apm: 3.2.2-2 -> 3.3.0
addrman: 3.2.2-2 -> 3.3.0
entman: 3.2.2-2 -> 3.3.0
mgmt: 3.2.2-2 -> 3.3.0
provman: 3.2.2-2 -> 3.3.0 
redis: 6.2.13 -> 6.2.14-debian-12-r21

Use the -j option to render the version information in JavaScript Object Notation (JSON) format.

Archive the APM Configuration Using the Kubernetes Command Line Tool

To archive a copy of the currently running APM configuration, enter the following command:

content_copy zoom_out_map
$ kubectl cp jnpr-apm/$( kubectl get pods -n jnpr-apm -l jnpr/cli=cli --no-headers=true | awk '{print $1}'):config/juniper.conf.gz ./juniper.conf.gz 

Uninstall and Remove APM Using the APM Utility

Use the apm utility script to uninstall the APM configuration. The uninstall command reverts the actions you performed when setting up APM. Use this command to return APM to the state it was in immediately after you installed the application but before you did any setup configuration.

To uninstall APM:

content_copy zoom_out_map
$ sudo -E apm stop –-context context-name
sudo -E apm unlink –-context context-name

After you uninstall APM, we recommend that you use the Debian uninstall procedure to remove the entire package.

content_copy zoom_out_map
$ sudo sudo -E apm clean [-h] [--log {error | warn | info | debug}] [--no-color] [--docker] [--release release-number] [--dry-run] [--uninstall] [--cluster-repos] ]

For the apm clean command options, see the following:

  • -h or --help—Show the help message and exit.

  • --log or -l {error | warn | info | debug}—Adjust the log level of the utility scrip.

  • --no-color—Print messages without colors.

  • --docker—Clean the local docker cache.

  • --release release-number—The release to clean (defaults to unused releases).

    --dry-run—List releases or containers that will be removed.

    --uninstall—Uninstall all software releases and remove APM from the system.

    --cluster-repos—Clean the cluster repos for the clusters that have been removed.

Uninstall and Remove APM Without Using the APM Utility

This is the uninstall procedure that you use if you installed APM without using the APM utility. You use the helm uninstall command to uninstall your APM configuration. To completely remove APM, you must run the helm uninstall command for each microservice.

To uninstall APM, run the following:

content_copy zoom_out_map
helm uninstall --kube-context <cluster-context> -n jnpr-apm provman
content_copy zoom_out_map
helm uninstall --kube-context <cluster-context> -n jnpr-apm entman
content_copy zoom_out_map
helm uninstall --kube-context <cluster-context> -n jnpr-apm addrman
content_copy zoom_out_map
helm uninstall --kube-context <cluster-context> -n jnpr-apm mgmt
content_copy zoom_out_map
helm uninstall --kube-context <cluster-context> -n jnpr-apm redis

How to Access APM Configuration and Operational Commands Using the APM Utility

Access the APM CLI Using the APM Utility

To access the CLI prompt, enter the following apm utility script command:

content_copy zoom_out_map
$ apm cli --context contextName [-p|--pipe]
content_copy zoom_out_map
root@jnpr-apm-mgmt

Enter a question mark to see the available top-level CLI commands. This list of commands is a subset of the Junos OS top-level commands.

content_copy zoom_out_map
root@jnpr-apm-mgmt> ?
Possible completions:
  clear                Clear information in the system
  configure            Manipulate software configuration information
  file                 Perform file operations
  help                 Provide help information
  monitor              Show real-time debugging information
  op                   Invoke an operation script
  quit                 Exit the management session
  request              Make system-level requests
  restart              Restart software process
  set                  Set CLI properties, date/time, craft interface message
  show                 Show system information
  ssh                  Start secure shell on another host
  start                Start shell
  telnet               Telnet to another host
  test                 Perform diagnostic debugging
  traceroute           Trace route to remote host

For an overview of Junos OS CLI basics, see Day One: Exploring the Junos CLI. For more detailed information, see the CLI User Guide.

Access and Use CLI Configuration Statements Using the APM Utility

  1. Use the APM utility command apm cli to access the top-level CLI prompt.
    content_copy zoom_out_map
    $ apm cli --context contextName
    root@jnpr-apm-mgmt> 
  2. Access configuration mode to configure APM and the information that APM uses to configure a managed router.
    content_copy zoom_out_map
    root@jnpr-apm-mgmt> configure
    root@jnpr-apm-mgmt# 
  3. Enter CLI statements to configure the APM-managed BNGs, pool domains, pools, and system attributes.
  4. Save and activate the configuration. This command succeeds only when there are no configuration syntax errors.
    content_copy zoom_out_map
    root@jnpr-apm-mgmt# commit
    commit complete
  5. (Optional) Exit configuration mode and return to the top-level CLI prompt.
    content_copy zoom_out_map
    root@jnpr-apm-mgmt# exit
    root@jnpr-apm-mgmt> 

Access and Use CLI Operational Commands Using the APM Utility

To monitor APM, view APM configuration and statistics, or run certain operations manually:

  1. Use the APM utility command apm cli to access the top-level CLI prompt.
    content_copy zoom_out_map
    $ $ apm cli --context contextName
    root@jnpr-apm-mgmt> 
  2. Enter specific commands.
    • Use show commands to display statistics and the relationships between partitions, BNGs, pool domains, and pools.

    • Use request commands to manually initiate certain APM operations.

How to Use the APM Command Line Tool Without Using the APM Utility

This section describes how you use the Kubernetes Command Line tool commands to perform administration functions.

You can use the Kubernetes Command Line tool to administer the application and to access the CLI that you use to configure the address management functions.

You can use the Kubernetes Command Line tool to do the following:

  • Create and delete objects.
  • Provide log access.
  • Conduct interactive sessions with pod containers.
  • Display the status of the APM objects.

Access the APM Command Line Tool Without Using the APM Utility

To access the APM Command Line tool using the Kubernetes commands, enter the following:

content_copy zoom_out_map
$ kubectl exec -it -n jnpr-apm $(kubectl get pods -n jnpr-apm -l jnpr/cli=cli --no-headers=true | awk '{print $1}') -- cli 

Enter a question mark to see the available top-level CLI commands.

content_copy zoom_out_map
 ?
Possible completions:
  clear                Clear information in the system
  configure            Manipulate software configuration information
  file                 Perform file operations
  help                 Provide help information
  monitor              Show real-time debugging information
  op                   Invoke an operation script
  quit                 Exit the management session
  request              Make system-level requests
  restart              Restart software process
  set                  Set CLI properties, date/time, craft interface message
  show                 Show system information
  ssh                  Start secure shell on another host
  start                Start shell
  telnet               Telnet to another host
  test                 Perform diagnostic debugging
  traceroute           Trace route to remote host
external-footer-nav
Ask AI
close

How can I help you today?

LLMs can make mistakes. Verify important information.
chat_add_on New topic
send progress_activity
This conversation will be monitored and recorded. Any information you provide will be subject to our Privacy Notice and may be used for quality assurance purposes. Do not include any personal or sensitive information. Ask AI can make mistakes. Verify generated output for accuracy.
Protected by hCaptcha arrow_drop_down arrow_drop_up
Juniper Networks, Inc. | Privacy Notice | Terms of Use