How to deploy the PHP agent in a Kubernetes environment?
The PHP agent (only PHP agent version 7.0 and above) can be deployed in a Kubernetes environment using either of the following methods.
To avoid using the license key, Application Name, and host in the deployment files, you can also store them in a configmap.
Modifying the Dockerfile
Follow the steps given in this help page to:
- Install the agent and Data Exporter during the image build
- Start the Data Exporter using an Entry Point script
Alternatively, instead of using a Entry Point script to start the Data Exporter, you can modify the helm chart to start the Data Exporter.
lifecycle:
postStart:
exec:
command: ["/bin/bash", "-c", "/opt/AppManagerDataExporter/bin/service.sh start"]
Without modifying the Dockerfile
- Download and install the agent and DataExporter in the postStart lifecycle hook without modifying the Dockerfile.
- Restart the web server and FastCGI Process Manager (FPM).
lifecycle:
postStart:
exec:
command: ["/bin/bash", "-c", "wget -O InstallAgentPHP.sh https://www.manageengine.com/products/applications_manager/54974026/InstallAgentPHP.sh && sh InstallAgentPHP.sh -license.key \"licensekey\" -zpa.application_name \"PHP-Application\" && wget -O InstallDataExporter.sh https://www.manageengine.com/products/applications_manager/54974026/InstallDataExporter.sh && sh InstallDataExporter.sh -root -nsvc -license.key \"licensekey\" -apm.host \"https://HOST-NAME:SSL-PORT\" && pkill -o -USR2 php-fpm"]
If you prefer to use values.yaml, configure as follows:
licensekey: <Applications Manager license key>
appname: <App name to be shown in APM>
apmhost: <http://hostname:port>
Use the following configuration in lifecycle hooks
lifecycle:
preStop:
exec:
command: ["/bin/bash", "-c", "service zpdpsvc stop;"]
postStart:
exec:
command: ["/bin/bash", "-c", "wget -O InstallAgentPHP.sh https://www.manageengine.com/products/applications_manager/54974026/InstallAgentPHP.sh && sh InstallAgentPHP.sh -license.key {{ .Values.appmanager.licensekey }}
-zpa.application_name {{ .Values.appmanager.appname }} && wget -O
InstallDataExporter.sh https://www.manageengine.com/products/applications_manager/54974026/InstallDataExporter.sh && sh InstallDataExporter.sh -root -nsvc -license.key {{ .Values.appmanager.licensekey }} -apm.host {{ .Values.appmanager.apmhost }} && pkill -o -USR2 php-fpm"]
New to ADSelfService Plus?
Related Articles
Adding APM Insight Java agent in a Kubernetes environment
There are three methods for installing the APM Insight Java agent in a Kubernetes environment: Using Dockerfile Using InitContainers Using Persistent Volumes Prerequisites Download the latest APM Insight Java agent ZIP file. Extract the ZIP file and ...
Absence of data in the Pods tab or some tabs in the Kubernetes monitor
This is a known issue in the older version of Applications Manager, which is fixed in APM v16800. So, we recommend upgrading the Applications Manager to the stable version to properly fix this issue. To collect data for the Kubernetes Monitor, ...
How to add an APM Insight Java agent in Kubernetes via InitContainers?
Step 1. Create a secret to access the APM Insight license key in your application namespace: kubectl create secret generic app-secret --from-literal=s247licensekey='your_APMInsight_license_key' -n petclinic The license key can be obtained from the ...
How to upgrade PHP Agent
PHP Agent version below 3.2.2 Manual upgrade from user terminal: Whenever a new version of the agent goes live, it will be listed in the APM Insight Download page. The latest agent can also be downloaded from the Applications Manager web client, from ...
Unable to Add Kubernetes Monitor
If you are having trouble adding a Kubernetes monitor in Applications Manager, ensure that the the prerequisites have been met: Verify whether you can establish an SSH connection to the Kubernetes server from the APM installed machine. Use the ...