Monitoring Ruby applications in Kubernetes environment
Before you monitor Ruby applications in Kubernetes environment, you must connect the data collector to the server by creating a secret. Then, you update your application deployment to monitor the Ruby applications.
Before you begin
- Check whether your service account has access to Kubernetes resources. For more information, see Authorizing the data collector to access Kubernetes resources.
- Ensure that you downloaded the configuration package to obtain the server information. For more information, see Obtaining the server configuration information.
- Check whether you downloaded the Ruby data collector package from Passport Advantage. For more information, see Downloading the Ruby data collector.
About this task
You can create a secret for the global.environment
file and the keyfiles that are extracted from the Monitoring configuration package. Then, you mount this secret when you deploy the application as a Kubernetes deployment. To enable
the Ruby data collector, you need to install stacktracer-20.06.00.gem
in Ruby application.
Procedure
-
Go to the
ibm-cloud-apm-dc-configpack
directory where you extract the configuration package in Obtaining the server configuration information, and run the following command to create a secret to connect to the server, for example, name it asicam-server-secret
.kubectl -n my_namespace create secret generic icam-server-secret \ --from-file=keyfiles/keyfile.p12 \ --from-file=keyfiles/ca.pem \ --from-file=global.environment
Where my_namespace is the namespace where you want to create the secret.
-
Put
stacktracer-20.06.00.gem
into the Ruby application folder, for example, app_folder/RubyDC
. -
In the Dockerfile, insert the following lines between the section of
bundle package
andbundle install
.RUN cp <app_folder>/RubyDC/stacktracer-20.06.00.gem <app_folder>/vendor/cache/ RUN echo "gem 'zipkin-tracer','>=0.32'" >> Gemfile RUN echo "gem 'stacktracer','=20.06.00'" >> Gemfile
-
Rebuild the application docker image.
docker build --network=host -t <image-name>:<version>
-
Repush it to a docker repository.
docker tag <image-name>:<version> <docker-repository>/<namespace>/<image-name>:<version> docker push <docker-repository>/<namespace>//<image-name>:<version>
-
Redeploy the application deployment in Kubernetes environment, or relaunch the docker image into container.