Installing EFK Operator on Redhat OpenShift Cluster for Logging
You can install IBM Mobile Foundation and run it on Red Hat Openshift 3.11 or later. Red Hat OpenShift is an enterprise Kubernetes platform that is designed to address the complex realities of container orchestration in production systems. IBM Mobile Foundation Services are deployed as pods in OpenShift Container Platform Cluster. There may be scenarios of pod crashes during or after the deployment. In such cases, it is not possible to retrieve the logs from the crashed pod. It is always important to persist the logs for further analysis to identify the root cause of the failure.
Elastic Search (ES) Operator and Cluster Logging (CL) Operator from the Operator Hub of Red Hat OpenShift Cluster helps in solving this problem.
Ensure that the Persistent Storage for Elasticsearch is setup.
Installing ElasticSearch and Cluster Logging Operator
Install the Elasticsearch Operator using the CLI
Follow the procedure mentioned at Install Elastic Search Operator.
Install the Cluster Logging Operator using the web console
Follow the procedure mentioned at Install Cluster Logging Operator.
Note: During testing on OCP 4.3, installation of CL operator hangs in the pending phase and it is found that the default channel selection is set to 4.5 during the subscription of CL Operator. To successfully install CL operator, first select 4.3 as the channel from the drop down and then select the project mentioned during CL subscription. The CL operator installation fails if you do not follow the order of selection.
Configuration on Mobile Foundation
After successfull installation of both the operators (ES and CL), the next step is to create the custom-configmap in the same namespace (project) as of Mobile Foundation.
Save the following content as customconfig.xml
<server> <logging consoleFormat="json" messageFormat="json" messageSource="message,trace,accessLog,ffdc,audit"> </server>
Create a custom configmap
kubectl create configmap mfpserver-custom-config --from-file=customconfig.xml
Provide the custom configmap in the CustomResource (charts_v1_mfoperator_cr.yaml) against the property customConfiguration. The custom configmap from the previous step example is mfpserver-custom-config. Install Mobile Foundation as mentioned in Install Mobile Foundation on OpenShift section.
Mention the above created configmap in the CustomResource.yaml and perform mf installation as mentioned in this document.
mfpserver: : : pdb: enabled: true min: 1 customConfiguration: "mfpserver-custom-config" keystoreSecret: ""
After Mobile Foundation is installed with the above configuration, the CL Operator copies the Pod logs and persists in the the ES storage.
- The logs can now be viewed on the Kibana dashboard. To obtain the Kibana URL, check the Networking > Routes section in the Red Hat OpenShift dashboard.
With this configuration in place, even if the pod crashes the logs are preserved.
Inclusive terminology note: The Mobile First Platform team is making changes to support the IBM® initiative to replace racially biased and other discriminatory language in our code and content with more inclusive language. While IBM values the use of inclusive language, terms that are outside of IBM's direct influence are sometimes required for the sake of maintaining user understanding. As other industry leaders join IBM in embracing the use of inclusive language, IBM will continue to update the documentation to reflect those changes.