Download PDF
Download page Network Visibility with Kubernetes.
Network Visibility with Kubernetes
This page provides instructions on how to configure Network Visibility to monitor applications running on Kubernetes.
Network Visibility monitors an application's network interactions and reports key performance metrics. These metrics isolate an application's network issues from its application issues.
The Network Agent uses a REST API to open a TCP port in each node for the application containers to communicate with the Network DaemonSet container. This communication enables monitoring between pods and nodes. You can deploy the agent as a DaemonSet in each node that has the host mode enabled.
Before You Begin
Before you create a Docker image for the DaemonSet and configure the agent, verify the following requirements:
- You have at least one pod with a Java Agent (version 4.4 and later) deployed to the same cluster as the Network Agent.
The TCP port 3892 is not already used by the node. The application pods use port 3892 to communicate with the DaemonSet.
Create a Network Visibility DaemonSet Docker Image
To configure Network Visibility with Kubernetes, you must first create a Docker image for the Network Visibility DaemonSet and push the image to your Docker Trusted Registry.
Paste this sample Dockerfile into a text file and save the file.
FROM ubuntu:14.04 ARG NETVIZ_ZIP_PKG RUN groupadd -r appd-netviz && useradd -r -g appd-netviz appd-netviz RUN apt-get update && apt-get install -y \ net-tools \ tcpdump \ curl \ unzip \ ssh-client \ binutils \ build-essential \ WORKDIR /netviz-agent # copy NetViz agent contents COPY $NETVIZ_ZIP_PKG . # run the agent install script and disable netlib RUN unzip $NETVIZ_ZIP_PKG && ./install.sh \ && sed -i -e "s|enable_netlib = 1|enable_netlib = 0|g" ./conf/agent_config.lua \ && sed -i -e "s|WEBSERVICE_IP=.*|WEBSERVICE_IP=\"0.0.0.0\"|g" ./conf/agent_config.lua RUN chown -R appd-netviz:appd-netviz /netviz-agent RUN setcap cap_net_raw=eip /netviz-agent/bin/appd-netagent USER appd-netviz # default command to run for the agent CMD ./bin/appd-netagent -c ./conf -l ./logs -r ./run
CODENavigate to the directory where you saved the Dockerfile and build the Docker image by entering the following command:
$ docker build --build-arg NETVIZ_ZIP_PKG=/path/to/netviz-agent-pkg.zip -t appd-netviz .
CODEPush the Docker image to your Docker Trusted Registry.
Configure Network Visibility with Kubernetes
Create a
yaml
file with the following configuration:apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 kind: DaemonSet metadata: name: appd-netviz-agent spec: selector: matchLabels: name: appd-netviz-agent template: metadata: name: appd-netviz-agent labels: name: appd-netviz-agent spec: hostIPC: true hostNetwork: true containers: - name: appd-netviz-agent image: path/to/your/Docker/image # docker registry image resources: requests: memory: "250Mi" cpu: "0.5" limits: memory: "2Gi" cpu: "1" securityContext: capabilities: add: ["NET_RAW"] ports: - containerPort: 3892 hostPort: 3892 imagePullSecrets: - name: your-registry-key # add the registry key, kubectl create secret ...
CODE- In the configuration file, update the following fields:
image
(undercontainers
): the file path to the DaemonSet image in your Docker Trusted Registry.name
(underimagePullSecrets
): the key for your Docker Trusted Registry.
Deploy the Network Agent in Kubernetes by entering the following command:
$ kubectl apply -f MyConfigFile.yaml
CODE
Configure Network Visibility to Monitor Application Pods
After deploying Network Visibility in Kubernetes, you must deploy at least one pod with a Java Agent (version 4.4 and later) to the same cluster as the Network Agent. This allows you to map network metrics to application flows.
Open the application's deployment configuration
yaml
file with Kubernetes in a text editor and set theAPPDYNAMICS_NETVIZ_AGENT_HOST
andAPPDYNAMICS_NETVIZ_AGENT_PORT
values:- name: APPDYNAMICS_NETVIZ_AGENT_HOST valueFrom: fieldRef: fieldPath: status.hostIP - name: APPDYNAMICS_NETVIZ_AGENT_PORT value: 3892
CODEIf you are using a version of the Java Agent that is 4.5.2 or older, you must open the
<app-agent-install-dir>/<version-number>/external-services/netviz/netviz-service.properties
file to set these values.- In the Controller UI, enable socket instrumentation to map network metrics to application flows. See Set Up the Network and App Agents.