Micro Learning (ENT CLI): Utilities & Diagnostics

This micro learning series will help you get familiar with Entando CLI (ENT) which simplifies building and deploying applications for Kubernetes.

Edward Shin - Tuesday, September 14, 2021
Tags: Technical

Micro Learning Series: ENT CLI

  1. Simplify App Development on Kubernetes with ENT CLI
  2. Quickstart Environment
  3. Packaging and Deployment
  4. Working with Multiple Environments
  5. Exporting Components
  6. Utilities & Diagnostics → This lesson
Entando_Tuesday_Blog_Post.png

What You’ll Learn

In this lesson, we’ll learn about the utilities and diagnostics ENT CLI provides to debug Entando applications running in a Kubernetes cluster. The output of each command is included so you can quickly see which ones may be useful to you at-a-glance.

Diagnostic Commands

Today, we’ll explore the ENT commands for debugging Entando applications.

- app Helps managing an EntandoApp - app-info Displays information about an entando app - diag Runs diagnostics and collects the related info in a tgz file - help - kubectl Helper for using kubectl in ent managed scenarios - pod Displays information related to a set of pods

ent app

The “ent app” command helps you to diagnose information about a currently running Entando application in Kubernetes. Note: An EntandoApp is fundamentally a web application running on Kubernetes that allows you to compose pages from micro frontends, microservices, and user-editable content.

Syntax: - ent app {command} ... Commands: - images print the images running in the current EntandoApp - configmap prints the configmap used to deploy the current EntandoApp - status prints status information about the current EntandoApp

images

The “images” subcommand provides a list of the container images running in a cluster.

$ ent app images docker.io/entando/entando-component-manager:6.3.26 docker.io/entando/entando-de-app-wildfly:6.3.68 docker.io/entando/entando-k8s-composite-app-controller:6.3.11 docker.io/entando/entando-k8s-controller-coordinator:6.3.9 docker.io/entando/entando-k8s-service:6.3.4 docker.io/entando/entando-keycloak:6.3.9

These container images represent the Entando Component Repository, Entando App Engine, Entando Cluster Infrastructure, and Entando Identity Management. Check out the Quickstart Environment blog post for more information on these images.

configmap

ConfigMaps contain environment-specific configuration.

$ ent app configmap data: app-builder: '{"version":"6.3.93","executable-type":"n/a","registry":"docker.io","organization":"entando"}' busybox: '{"version":"latest","executable-type":"jvm","registry":"docker.io","organization":"entando"}' entando-avatar-plugin: '{"version":"6.0.5","executable-type":"jvm","registry":"docker.io","organization":"entando"}' entando-component-manager: '{"version":"6.3.26","executable-type":"jvm","registry":"docker.io","organization":"entando"}' ...

status

The status subcommand provides information about a running Entando application.

$ ent app status Version "/home/ubuntu/.entando/ent/v6.3.2/cli/v6.3.2" activated ➤ [I] | 2021-09-03 12-53-31 | NODES: NAME STATUS ROLES AGE VERSION entando Ready master 17d v1.19.11+k3s1 ➤ [I] | 2021-09-03 12-53-32 | PODS: NAME READY STATUS RESTARTS AGE quickstart-composite-app-deployer-9097 0/1 Error 0 17d quickstart-kc-server-deployment-5f9d7897c6-7sgzw 1/1 Running 9 17d quickstart-eci-k8s-svc-deployment-76fb9cfb4d-srfsw 1/1 Running 73 17d quickstart-server-deployment-68bf454dcc-v6c98 1/1 Running 8 17d quickstart-ab-deployment-7d78b79c-qsdbt 1/1 Running 7 17d quickstart-cm-deployment-546bc6b578-7nrnb 1/1 Running 18 17d entando-operator-df5dff8dd-llqpm 1/1 Running 27 17d ➤ [I] | 2021-09-03 12-53-33 | Application Ingress path: http://quickstart-entando.192.168.64.40.nip.io/entando-de-app/

Here, we can view:

  • ENT CLI version installed in our development cluster.
  • Nodes: Physical or virtual server.
  • Pods: The running processes that make up an Entando application.
  • Ingress: The URL to access the Entando application.

ent app-info

Alias for:

ent app status

ent diag

The diag command contains a treasure trove of information. It exports a .tgz file that contains all of the information for a running Entando application including all logs for the containers in each pod as well as a description of each pod.

$ ent diag Please provide the the namespace (entando): entando ## NODES ## CONFIG MAP ## CRD list ## POD list ## DNS rebinding protection TEST ## LOCAL INFO ## K8S INFO > POD: quickstart-composite-app-deployer-9097 > CONTAINER: deployer > POD: quickstart-kc-server-deployment-5f9d7897c6-7sgzw > CONTAINER: server-container ... > Collected diagdata available under "/Users/ed/.entando/reports/entando-diagdata-2021-09-03T20:05:31+0000" for consultation > Collected diagdata available in archive "/Users/ed/.entando/reports/entando-diagdata-2021-09-03T20:05:31+0000.tgz"

Here’s a snapshot of the files it exports:

basics.txt entando-operator-df5dff8dd-llqpm-operator.logs.txt entando-operator-df5dff8dd-llqpm.describe.txt quickstart-ab-deployment-7d78b79c-qsdbt-appbuilder-container.logs.txt quickstart-ab-deployment-7d78b79c-qsdbt.describe.txt quickstart-cm-deployment-546bc6b578-7nrnb-de-container.logs.txt quickstart-cm-deployment-546bc6b578-7nrnb.describe.txt quickstart-composite-app-deployer-9097-deployer.logs.txt quickstart-composite-app-deployer-9097.describe.txt quickstart-eci-k8s-svc-deployment-76fb9cfb4d-srfsw-k8s-svc-container.logs.txt quickstart-eci-k8s-svc-deployment-76fb9cfb4d-srfsw.describe.txt quickstart-kc-server-deployment-5f9d7897c6-7sgzw-server-container.logs.txt quickstart-kc-server-deployment-5f9d7897c6-7sgzw.describe.txt quickstart-server-deployment-68bf454dcc-v6c98-server-container.logs.txt quickstart-server-deployment-68bf454dcc-v6c98.describe.txt

And a quick snapshot of one of the logs: (In this example, we’re looking at the Keycloak logs.)

Added 'entando_keycloak_admin' to '/opt/jboss/keycloak/standalone/configuration/keycloak-add-user.json', restart server to load user -b 0.0.0.0 ========================================================================= JBoss Bootstrap Environment JBOSS_HOME: /opt/jboss/keycloak JAVA: java JAVA_OPTS: -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true ... =========================================================================

As well as the description of the corresponding pod:

Name: quickstart-kc-server-deployment-5f9d7897c6-7sgzw Namespace: entando Priority: 0 Node: entando/192.168.64.40 Start Time: Tue, 17 Aug 2021 09:18:34 -0700 Labels: EntandoKeycloakServer=quickstart-kc EntandoResourceKind=EntandoKeycloakServer deployment=quickstart-kc-server pod-template-hash=5f9d7897c6 Annotations: Status: Running IP: 10.42.0.71 IPs: IP: 10.42.0.71 Controlled By: ReplicaSet/quickstart-kc-server-deployment-5f9d7897c6 Containers: server-container: Container ID: containerd://ef908aff91866242bab87ebe4c084a0f15742fd4fb6c50846af9322be2f5cbe7 Image: docker.io/entando/entando-keycloak:6.3.9 ...

ent help

Help text is provided for each command and subcommand. Usage:

ent app --help

ent kubectl

A convenient utility to call kubectl for the current ENT profile.

$ ent kubectl get pods NAME READY STATUS RESTARTS AGE quickstart-composite-app-deployer-9097 0/1 Error 0 17d quickstart-kc-server-deployment-5f9d7897c6-7sgzw 1/1 Running 9 17d quickstart-eci-k8s-svc-deployment-76fb9cfb4d-srfsw 1/1 Running 73 17d ...

This command automatically uses the kubeconfig file, context, and namespace configured in your ENT profile. (See: Working With Multiple Environments) In the above example, even without a namespace specified, ent kubectl knows to only get pods from the entando namespace.

ent pod

The pod command allows you to diagnose information about the pods running in the namespace of your Entando application.

Syntax: - ent pod {command} ... Commands: - grep greps the pods logs - describe describes a pod - list shows the list of pods - shell run a shell into the pod - logs show the logs of a pod

grep

A utility for searching the logs in all Entando pods.

$ ent pod grep Please provide the the log grep pattern: error ==================================================================================================== > POD: quickstart-composite-app-deployer-9097 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > CONTAINER: quickstart-composite-app-deployer-9097/deployer exec java -Djava.util.logging.manager=org.jboss.logmanager.LogManager -XX:+ExitOnOutOfMemoryError -cp . -jar /deployments/app.jar ==================================================================================================== > POD: quickstart-kc-server-deployment-5f9d7897c6-7sgzw ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > CONTAINER: quickstart-kc-server-deployment-5f9d7897c6-7sgzw/server-container 18:04:28,061 INFO [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 65) RESTEASY002205: Adding provider class org.keycloak.services.error.KeycloakErrorHandler from Application class org.keycloak.services.resources.KeycloakApplication

describe

A utility to describe all Entando pods. This is basically “kubectl describe pod” for all Entando pods so it’s generally not needed.

$ ent pod describe ==================================================================================================== > POD: quickstart-composite-app-deployer-9097 Name: quickstart-composite-app-deployer-9097 Namespace: entando Priority: 0 Node: entando/192.168.64.40 Start Time: Tue, 17 Aug 2021 09:18:08 -0700 Labels: EntandoCompositeApp=quickstart-composite-app EntandoResourceKind=EntandoCompositeApp EntandoResourceNamespace=entando

list

List all Entando pods.

$ ent pod list NAME READY STATUS RESTARTS AGE quickstart-composite-app-deployer-9097 0/1 Error 0 17d quickstart-kc-server-deployment-5f9d7897c6-7sgzw 1/1 Running 9 17d quickstart-eci-k8s-svc-deployment-76fb9cfb4d-srfsw 1/1 Running 73 17d quickstart-server-deployment-68bf454dcc-v6c98 1/1 Running 8 17d quickstart-ab-deployment-7d78b79c-qsdbt 1/1 Running 7 17d quickstart-cm-deployment-546bc6b578-7nrnb 1/1 Running 18 17d entando-operator-df5dff8dd-llqpm 1/1 Running 28 17d

shell

A convenient method for shelling into a pod.

$ ent pod shell 1) quickstart-composite-app-deployer-9097 2) quickstart-kc-server-deployment-5f9d7897c6-7sgzw 3) quickstart-eci-k8s-svc-deployment-76fb9cfb4d-srfsw 4) quickstart-server-deployment-68bf454dcc-v6c98 5) quickstart-ab-deployment-7d78b79c-qsdbt 6) quickstart-cm-deployment-546bc6b578-7nrnb 7) entando-operator-df5dff8dd-llqpm q) to quit POD: 5 Opening shell for "quickstart-ab-deployment-7d78b79c-qsdbt/appbuilder-container" sh-4.4$

logs

A very useful command for getting the logs of a running Entando pod. Note: Use the “-c” argument to get the logs of a container running inside a pod.

$ ent pod logs -c 1) quickstart-composite-app-deployer-9097 2) quickstart-kc-server-deployment-5f9d7897c6-7sgzw 3) quickstart-eci-k8s-svc-deployment-76fb9cfb4d-srfsw 4) quickstart-server-deployment-68bf454dcc-v6c98 5) quickstart-ab-deployment-7d78b79c-qsdbt 6) quickstart-cm-deployment-546bc6b578-7nrnb 7) entando-operator-df5dff8dd-llqpm q) to quit POD: 4 Executing "logs" command against "quickstart-server-deployment-68bf454dcc-v6c98/server-container" INFO Running wildfly/wildfly-centos7 image, version 17.0 -XX:+UseParallelOldGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:MaxMetaspaceSize=100m -XX:ParallelGCThreads=2 -Djava.util.concurrent.ForkJoinPool.common.parallelism=2 -XX:CICompilerCount=2 -XX:+ExitOnOutOfMemoryError ========================================================================= JBoss Bootstrap Environment JBOSS_HOME: /wildfly/ JAVA: /usr/lib/jvm/java-11/bin/java

What’s Next?

In this lesson, we learned about ENT tools that help us to debug Entando applications running on Kubernetes. In particular, take note of “ent diag” which provides all of the Kubernetes and application level logs for an Entando application in a .tgz file. And also keep in mind “ent pod” which makes it much easier to search and view the logs for Entando pods. Check out our other blog series!

  • Entando bundle series → Discovering the components that make up an Entando application
  • Standard Demo series → A robust example of how to deploy micro frontends with React and Angular examples, microservices, and CMS content that we use to demo the product to our customers.

Additional Resources

WHITE PAPER

CIO Alert - There is an Application Composition Platform in your Future

By Massimo Pezzini, Independent IT Advisor

GET YOUR FREE COPY

White-Paper-Pattern_mockup 3.png