How to install the Magalix agent to connect your Kubernetes cluster
The first time you log into your account you will find a kubectl command pre-fabricated to connect your first Kubernetes cluster to Magalix backend. Copy and paste that command into your console as instructed on the welcome page.
Connecting More Clusters
Creating the YAML can be initiated through the "Connect Cluster" wizard, by clicking the "Start" button on the homepage.
The wizard will guide you through the process, follow the workflow and hit "Finish" when you are done.
At this point, the cluster has been defined and waiting for a connection with the Agent to start communication.
To finish the process, the YAML needs to be applied to your cluster, you can achieve that in one of two ways. Using the automatically generated URL or manually downloading and applying the YAML to your cluster.
Permissions And Admin Access
If your Cluster is RBAC enabled, you must have admin access to install the Magalix Agent
To gain admin rights you'll need to execute the following command.
kubectl create clusterrolebinding username-cluster-admin-binding --clusterrole=cluster-admin --email@example.com
The username can be case sensitive in some IAM systems, GCP for example. Make sure you are using the right case when you create the ClusterRoleBinding, otherwise the user won't be authorized to deploy the Agent.
Using The Secure URL
In the middle of the page of the define cluster wizard, you'll see a URL and a copy icon to the left. To install the Agent, copy the command and paste it in your terminal. If successful, you'll see output similar to the one below.
$ kubectl apply -f https://dev1.console.magalix.com/cluster-deployment/6aa6689b-252b-4df0-bf1e-46c1436cf551/2018-09-10T19:58:06Z/5d7e8540597bacf2e26d76dcd1bce1b679cf36676112218d134f8dd2da60a6e4/deployment.yaml
Using The Agent YAML
The review page of the "Connect Cluster" wizard provides a "Download" button which you can use to locally save the YAML of the Magalix Agent. To download the YAML, expand the panel and click the blue download button on the left. You can also download the YAML from the cluster dashboard showing after you hit finish.
To install the Agent type the following command in your terminal.
$ Kubectl apply -f <LocalPath>\fileName.yaml
Delete Cluster Definition
If you no longer need to connect the cluster, you can select "Delete Cluster Definition", it will remove the cluster definition.
Validate The Agent Deployment
To validate if the Magalix Agent pod has been successfully installed, use the following command. You should see something like magalix-agent-865b6d9ffb-n4v9w in the listed pods
$ kubectl get pods --namespace kube-system
NAME READY STATUS RESTARTS AGE
event-exporter-v0.1.8-599c8775b7-fprtf 2/2 Running 0 1d
fluentd-gcp-v2.0.9-vhg24 2/2 Running 0 1d
heapster-v1.4.3-d74857f95-8tz25 3/3 Running 0 1d
kube-dns-778977457c-6vkdf 3/3 Running 0 1d
kube-dns-autoscaler-7db47cb9b7-w4q49 1/1 Running 0 1d
kube-proxy-gke-sandbox-default-pool-a57643f1-s22p 1/1 Running 0 1d
kubernetes-dashboard-6bb875b5bc-8jzxn 1/1 Running 0 1d
l7-default-backend-6497bcdb4d-4z8g5 1/1 Running 0 1d
magalix-agent-865b6d9ffb-n4v9w 1/1 Running 1 1d
tiller-deploy-dccdb6fd9-r4b4f 1/1 Running 0 1d
If you run the same connection command on multiple clusters, this will push the data concurrently from all of them, which will generate unexpected behavior and recommendations. Define a new cluster and run its command if you have than one cluster to connect.