How to deploy the PHP agent in a Kubernetes environment?

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:
  1. Install the agent and Data Exporter during the image build 
  2. 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

  1. Download and install the agent and DataExporter in the postStart lifecycle hook without modifying the Dockerfile. 
  2. Restart the web server and FastCGI Process Manager (FPM).
Example:
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?