Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Installing AppFormix for Kubernetes

 

AppFormix provides resource control and visibility for nodes and containers in a Kubernetes cluster.

This topic explains how to install AppFormix for Kubernetes. See AppFormix General Requirements before reading this section.

Architecture

Figure 1 shows the different components of AppFormix and how they interact with the Kubernetes cluster. On the left are the nodes of a 3-node Kubernetes cluster: kube-master, kube-node1, and kube-node2. Each of these nodes has AppFormix Agent running on it, which streams data directly to the Dashboard server. The Appformix Kubernetes Adapter communicates with kube-master to read the configuration of the cluster.

On the right are the other components of the AppFormix Platform. The Controller communicates with the Agent running on all the Kubernetes nodes. The Controller and DataManager communicate with the Kubernetes Adaptor, as well as with Mondo and Redis.

Figure 1: AppFormix and Kubernetes Workflow
AppFormix and Kubernetes Workflow

Requirements

The following are the requirements for installing AppFormix for Kubernetes.

  • Kubernetes version 1.8.

  • API access to the Kubernetes API server.

    AppFormix reads information about the cluster from the API server. The token provided during configuration must provide sufficient permission for read-only API calls.

    AppFormix Platform must also be able to open a connection to the host and port on which the API server runs.

Workflow in Three Steps

The installation consists of the following steps:

Configure Kubernetes

AppFormix reads information about resources in your Kubernetes clusters. It requires the cluster-admin role or another role that provides read-only access to all objects in the cluster. We recommend that you create a new Service Account for AppFormix and assign it the cluster-admin role.

If you do not create a new Service Account, then you must provide the token from an existing Service Account that has the required access during the configuration of AppFormix.

To create a new Service Account with the required access for AppFormix, perform the following steps in the Kubernetes cluster:

  1. Create a YAML file with the following contents:
  2. Create the appformix Service Account using the file you created above:
    $ kubectl create -f <file>.yaml
  3. Confirm that the Service Account has been created. Make a note of its namespace as you’ll need this later.
    $ kubectl describe serviceaccount appformix
  4. Add the cluster-admin role to the appformix Service Account, substituting <namespace> for the namespace noted in Step 3:
    $ kubectl create clusterrolebinding appformix-binding --clusterrole=cluster-admin --serviceaccount=<namespace>:appformix
  5. Run the following to command to confirm that the 'appformix' Service Account has the required access:
    $ kubectl auth can-i get nodes --as=system:serviceaccount:<namespace>:appformix --all-namespaces

    The output of the command should be yes.

Creating An Ansible Inventory

Ansible is used to deploy the software to the Kubernetes nodes and the Platform Host. An Ansible inventory file describes groups of hosts in your cluster. Define the inventory in a separate location than the release files, so that the inventory may be reused for an upgrade.

AppFormix requires two groups: compute and appformix_controller. Each group lists the hosts in that group. The compute group should include the Kubernetes master and worker nodes. Only the agent is installed on the compute hosts. The agent and the AppFormix platform services are installed on the appformix_controller host.

Create a directory, for example inventory, that contains a hosts file and a group_vars/all file. For example:

The inventory/hosts file contains the list of hosts in each group. For example:

For more information, see the Ansible Inventory documentation.

Ansible Configuration Variables

The AppFormix software includes a number of Ansible roles to perform the configuration of AppFormix settings. Define the values of variables in the inventory/group_vars/all file in order to be able to use the settings and inventory for future upgrades.

In the inventory/group_vars/all file, configure the following variables for installation of AppFormix for Kubernetes.

appformix_license: /path/license_file appformix_docker_images:

- /path-to/appformix-platform-images-<version>.tar.gz

- /path-to/appformix-dependencies-images-<version>.tar.gz

- /path-to/appformix-kubernetes-images-<version>.tar.gz

See Platform Dependencies for steps on installing dependencies on a Platform Host that cannot fetch files from the Internet.

AppFormix must be configured to communicate with the Kubernetes cluster. Define the following variables in the inventory/group_vars/all file:

  • kubernetes_cluster_url—Set this to the URL of the Kubernetes API Server.

    To get this value, run the following command on the Kubernetes cluster:

    $ kubectl cluster-info | grep 'Kubernetes master'
  • kubernetes_auth_token—Set this to the authentication token of the appformix Service Account.

    To get this value, run the following commands on the Kubernetes cluster:

    $ kubectl describe serviceaccount appformix

    Name: appformix

    Namespace: default

    Labels: <none>

    Annotations: <none>

    Tokens: appformix-token-pkljk

    ...

    $ kubectl describe secret appformix-token-pkljk

    Name: appformix-token-pkljk

    Namespace: default

    ...

    token: eyJhb

    ...

    After adding these variables, the inventory/group_vars/all file should look similar to this:

Configuring an HTTP Proxy for Fetching Prerequisites

The Ansible playbook fetches files from the Internet to install prerequisites on the Platform Host. If the Platform Host requires an HTTP proxy to access the Internet, configure the following variables in inventory/group_vars/all:

prerequisites_env is a dictionary that defines environment variables to be used when invoking commands to install prerequisites. In the above example, the same proxy URL, http://proxy.example.com:1234, is used for both the http_proxy and https_proxy environment variables because the single proxy can be used to access both HTTP and HTTPS URLs. As a convenience, the proxy URL is defined once in the http_proxy_url variable.

Modify prerequisites_env as necessary for the proxy requirements of your network.

Installing AppFormix

Execute the following commands on the host from which Ansible will be run. For example, this may be the Platform Host, or any host with Ansible and SSH access to the compute node(s) and the Platform Host.

  1. Copy the following files to the host on which Ansible playbooks will be executed. The path of the images files should match the configuration setting made in the Ansible inventory.

    For more information, see Ansible Configuration Variables above.

    appformix-<version>.tar.gz
    appformix-platform-images-<version>.tar.gz
    appformix-dependencies-images-<version>.tar.gz
    appformix-kubernetes-images-<version>.tar.gz
  2. Unpack the tarball, and change to the created directory.
    tar xzf appformix-<version>.tar.gz
    cd appformix-<version>
  3. Install AppFormix by executing the appformix_kubernetes.yml playbook.

    Specify the path to the inventory directory that you created earlier.

    ansible-playbook -i /path/appformix_kubernetes.yml
  4. Open the AppFormix Dashboard in a Web browser. For example:
    http://appformix01:9000/appformix
  5. Click Skip Installation.

    The initial configuration was performed by Ansible using the Kubernetes cluster configuration provided earlier.

  6. Log in to AppFormix Dashboard.

Upgrading AppFormix for a Kubernetes Cluster

AppFormix can be upgraded by running the appformix_kubernetes.yml playbook of the new release. Follow the same procedure as for installing Appformix described above.

Uninstalling AppFormix from a Kubernetes Cluster

If you need to uninstall AppFormix and destroy all data, execute the following command:

ansible-playbook -i <inventory_file> clean_appformix_kubernetes.yml