Deploying the Site24x7 PHP agent in a Kubernetes environment

How to deploy the Site24x7 PHP agent in a Kubernetes environment?

For PHP version 7.0 and above

The PHP agent (PHP version 7.0 and above) can be deployed in a Kubernetes environment using any of the following methods.

NotesYou can also keep the license keys in a configmap to avoid using them in the deployment files.

Using InitContainers

Refer to this help page to understand the process of integrating the APM Insight PHP agent into your Kubernetes deployment using Init Containers.

Modifying the Dockerfile

Follow the steps given in this help page to achieve the following:
  1. Install the PHP agent and S247DataExporter in the same docker container during the image build.
  2. Start the DataExporter using an Entry Point Script.
Notes
  Instead of using an Entry Point Script, you can modify the Helm chart to start the S247DataExporter.

Helm chart modification to start the S247DataExporter:
  1. lifecycle:
  2.       postStart:
  3.             exec:
  4.                   command: ["/bin/bash", "-c", "/opt/S247DataExporter/bin/service.sh start"]


Without modifying the Dockerfile

  1. Download and install the PHP agent and S247DataExporter in the postStart lifecycle hook without modifying the Dockerfile.
  2. Restart the web server and FastCGI Process Manager (FPM).

    Note: To restart the web server, use the command /etc/init.d/apache2 reload or kill -USR1 1 for Apache-based servers. If you are using NGINX- or FPM-based servers, include the command kill -USR2 1.

    Example:
  1. lifecycle:
  2.         postStart:
  3.             exec:
  4.                 command: ["/bin/bash", "-c", "wget -O InstallAgentPHP.sh https://staticdownloads.site24x7.com/apminsight/agents/AgentPHP/linux/InstallAgentPHP.sh && sh InstallAgentPHP.sh -license.key \"licensekey\" -zpa.application_name \"PHP-Application\" && wget -O InstallDataExporter.sh https://staticdownloads.site24x7.com/apminsight/S247DataExporter/linux/InstallDataExporter.sh && sh InstallDataExporter.sh -root -nsvc -license.key \"licensekey\" && pkill -o -USR2 php-fpm"]

For PHP version below 7.0

The PHP agent (PHP version below 7.0) can be deployed in a Kubernetes environment using the following method.

With Helm charts

If you are deploying with Helm, you can include the installation script in the Helm charts file.
Notes
Add the following to the template folder or deployment.yaml, or if you prefer to use values.yaml, configure as follows:
  1. site24x7:
  2.   apikey: <site24x7 license key>
  3.   appname: <App name to be shown in APM>
Use the following configuration in lifecycle hooks:
  1. lifecycle:
  2.       preStop:
  3.          exec:
  4.              command: ["/bin/bash", "-c", "service zpdpsvc stop;"]
  5.       postStart:
  6.           exec:
  7.                command: ["/bin/bash", "-c", "wget https://staticdownloads.site24x7.com/apminsight/scripts/s247apmphpinstall.sh && ./s247apmphpinstall.sh -key={{ .Values.site24x7.apikey }} -appname={{ .Values.site24x7.appname }} ; /etc/init.d/apache2 reload ;" ]

Related articles

How to install various APM Insight agents in a Docker container

How to install various APM Insight agents in a Kubernetes environment

    • Related Articles

    • Site24x7 Real User Monitoring (RUM) - Data Collection

      When you include Site24x7 RUM beacon script in your web pages, the following data is collected. All data that's being collected is in accordance with GDPR compliance. Performance details of web page load time - Metrics like response time of web page ...
    • Where are Site24x7's physical data storage regions located?

      Site24x7's integrated data centers are located in the US, European Union, India, China, Australia, and Japan. All Site24x7 customer-related data are stored in these physical storage regions. Data Center Primary Data Center Disaster Recovery Data ...
    • How do I monitor an Oracle database hosted in a Docker container in the same machine?

      To monitor your Oracle Database hosted in a Docker container, follow these steps: Log in to Site24x7 and install the Site24x7 Linux monitoring agent. Execute the following command in your terminal and enter your Oracle Database instance's username ...
    • No data for service and process in Windows server monitor

      If you see "No Data" for process and service metrics (such as CPU or memory usage of monitored services) in the Site24x7 Windows server monitor user interface, follow the troubleshooting steps below. Run PowerShell Commands Open PowerShell as ...
    • APM Insight integration for Next.js in Kubernetes

      To integrate the Site24x7 APM Insight Next.js agent into your Kubernetes application using initContainers with the prebuilt agent image, follow the steps below: Prerequisites A Next.js application container image The Site24x7 APM Insight license key ...