Setting up service graph

Software requirements

Kubernetes Distribution Kubernetes Version Container Network Interfaces (CNI) CPX version CIC version Citrix ADM version Citrix ADM Agent Version
Open source v1.16.3 Flannel, Calico, or Canal 13.0–41.28 1.5.25 13.0–47.22 13.0–47.22

Before you begin

You can view service graph using the following scenarios:

  • Citrix ADM and Kubernetes cluster on the same network (for example, Citrix ADM and Kubernetes cluster hosted on the same Citrix Hypervisor).

  • Citrix ADM and Kubernetes cluster on a different network. In this scenario, you must configure an on-prem agent and register the agent on the network, where Kubernetes cluster is hosted.

To use service graph in Citrix ADM, ensure you have:

Configure static routes in Citrix ADM

Inside the Kubernetes cluster, all containerized pods use an overlay network. Establishing the communication using those private IP addresses directly is not possible. To enable communication from Citrix ADM to Kubernetes cluster, you must configure static routing in Citrix ADM.

Note

If you are using an on-prem agent, ensure you configure static routes on the agent. Using an SSH client, log on to Citrix ADM agent and configure the static routes.

Consider that you have the following IP addresses for your Kubernetes cluster:

  • Kubernetes master – 10.106.157.112

  • Kubernetes worker 1 – 10.106.157.110

  • Kubernetes worker 2 – 10.106.157.111

  1. Using an SSH client, log on to Citrix ADM

  2. Configure the static routing using the command route add -net <public IP address range> <Kubernetes IP address>

    For example:

    route add -net 192.168.0.0/24 10.106.157.112

    route add -net 192.168.1.0/24 10.106.157.111

    route add -net 192.168.2.0/24 10.106.157.110

  3. Verify the configuration by using netstat -rn

    static routing

  4. Append these route commands in /mpsconfig/svm.conf file.

    1. In Citrix ADM, access the svm.conf file using the following command:

      vim /mpsconfig/svm.conf

    2. Add the static routes in svm.conf file.

      For example, route add -net 192.168.0.0/24 10.106.157.112.

Download the sample deployment files from GitHub

  1. Use the command git clone https://github.com/citrix/citrix-k8s-ingress-controller.git to clone the git hub repository in the master node.

  2. To access the YAMLs:

    cd citrix-k8s-ingress-controller/example/servicegraph-demo/

Add parameters in CPX YAML file

You must include the following parameters in the CPX YAML file to ensure CPX registration with Citrix ADM:

- name: "NS_MGMT_SERVER"
  value: "10.106.150.72"
- name: "NS_MGMT_FINGER_PRINT"
  value: "E3:3A:2B:F7:CC:A6:3D:72:8F:3E:3E:4F:0D:C3"
- name: "NS_HTTP_PORT"
  value: "9080"
- name: "NS_HTTPS_PORT"
  value: 9443"
- name: "LOGSTREAM_COLLECTOR_IP"
  value: "10.106.150.72"

CPX YAML file

  • NS_MGMT_SERVER – Indicates the Citrix ADM IP address

    Note

    If an ADM agent is used, you must use the on-prem agent IP address.

  • NS_MGMT_FINGER_PRINT – Indicates the authentication for CPX in Citrix ADM. To get the fingerprint:

    1. In Citrix ADM, navigate to System > Administration

    2. Under System Configurations, click View ADM Fingerprint

      Fingerprint

      Note:

      If you have configured an on-prem agent, navigate to Networks > Agents, select the agent, and then click View Fingerprint.

      Fingerprint agent

  • NS_HTTP_PORT – Indicates the HTTP port for communication

  • NS_HTTPS_PORT – Indicates the HTTPS port for communication

  • LOGSTREAM_COLLECTOR_IP – Indicates the Citrix ADM agent IP address, where Logstream protocol must be enabled to transfer log data from CPX to ADM

Add Kubernetes cluster in Citrix ADM

After you configure static routes, you must add the Kubernetes cluster in Citrix ADM.

To add the Kubernetes cluster:

  1. Log on to Citrix ADM with administrator credentials.

  2. Navigate to Orchestration > Kubernetes > Cluster. The Clusters page is displayed.

  3. Click Add.

  4. In the Add Cluster page, specify the following parameters:

    Note

    • If you have configured an on-prem agent, ensure you select the same agent IP address that you have added in the CPX YAML.

    • If no agent is configured, you can leave the Agent field blank.

    add cluster

    1. Name - Specify a name of your choice.

    2. API Server URL - You can get the API Server URL details from the Kubernetes Master node.

      1. On the Kubernetes master node, run the command kubectl cluster-info.

        API Server URL

      2. Enter the URL that displays for “Kubernetes master is running at.”

    3. Authentication Token - Specify the authentication token. The authentication token is required to validate access for communication between Kubernetes cluster and Citrix ADM. To generate an authentication token:

      On the Kubernetes master node:

      1. Create a service account by using the YAML.

        kubectl create -f adm_svc_account.yaml

        The service account is created.

      2. Run kubectl create clusterrolebinding citrixadm-sa-admin --clusterrole=cluster-admin --serviceaccount=default:citrixadm-sa to bind the cluster role to service account.

        The service account now has the cluster-wide access.

        A token is automatically generated while creating the service account.

      3. Run kubectl describe sa citrixadm-sa to view the token.

      4. To get the secret string, run kubectl describe secret <token-name>.

        Generate token

    4. Select the agent from the list.

    5. Click Create.

      You can view data in service graph, after enabling the auto-select virtual servers for licensing.

Deploy a sample microservice application

On the master node:

  1. Run kubectl create -f namespace.yaml to create a namespace.

  2. Deploy hotdrink microservices, ingress, and secrets using following commands:

    kubectl create -f team_hotdrink.yaml -n sg-demo

    kubectl create -f hotdrink-secret.yaml -n sg-demo

Deploy CPX and register CPX in ADM

  1. Run kubectl create -f rbac.yaml to deploy cluster role and cluster binding.

  2. Run kubectl create -f cpx.yaml -n sg-demo to deploy CPX.

Enable Auto-select virtual servers for licensing

After you add Kubernetes cluster in Citrix ADM, you must ensure to auto-select virtual servers for licensing. Virtual servers need to be licensed to display data in service graph. To auto-select virtual servers:

  1. Navigate to System > Licensing & Analytics.

  2. Under Virtual Server License Summary, enable Auto-select Virtual Servers and Auto-select non addressable Virtual Servers.

    Auto-select virtual server

Enable Web Transaction setting

After you add the Kubernetes cluster and enable the auto-select virtual servers, change the Web Transaction Settings to All. To enable this setting:

  1. Navigate to Analytics > Settings.

    The Settings page is displayed.

  2. Click Enable Features for Analytics.

  3. Under Web Transaction Settings, select All and click OK.

    web-transaction-settings

Send traffic to microservices

Next, you must send traffic to microservices to get the service graph populated in Citrix ADM.

  1. Run kubectl get svc -n sg-demo to expose CPX through NodePort.

    NodePort

  2. Edit the etc/host file and create a domain IP entry for hotdrink.beverages.com

    You can now access the microservice using https://hotdrink.beverages.com