Step 1: Execute the below command to create a new serviceaccount.
kubectl create serviceaccount applicare -n default
Step 2: Create a applicareapi-cluster-role.yml file with the below content.
apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: applicareapi-cluster-role namespace: default
rules:
- apiGroups:
- "*"
resources:
- nodes
- namespaces
- pods
- services
verbs: ["get", "list", "watch"]
Step 3: Execute below command in the same directory where the file was created.
kubectl apply -f applicareapi-cluster-role.yml
Step 4: Create a applicareapi-cluster-role-binding.yml file with the below content.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: applicareapi-cluster-role-binding
subjects:
- namespace: default
kind: ServiceAccount
name: applicare
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: applicareapi-cluster-role
Step 5: Rolebinding is created for the serviceaccount by execute the below command.
kubectl apply -f applicareapi-cluster-role-binding.yml
Step 6: Execute kubectl top nodes in the kubernetes. If you are not able to view the below details then execute Step 7 otherwise go to Step 8.
Step 7: Install metrics pod in the Kubernetes. Execute the the below command to install metrics pod.
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
Check if the metrics server is running by executing the below command.
kubectl get pods -n kube-system
Note: If it is running then go to Step 8. If it is not running then follow the below steps
1: Edit the configuration file by executing the below command.
kubectl edit deployments.apps -n kube-system metrics-server
2: Add the below lines in the spec: container: args: and save the file.
- --kubelet-insecure-tls
3: After few minutes execute the command kubectl get pods -n kube-system and check the metrics server is running. If it is running skip the below step.
4: Edit the configuration file by executing the command kubectl edit deployments.apps -n kube-system metrics-server and modify the below lines in the spec: container: args: and save it.
- --kubelet-preferred-address-types=InternalIP
5: To verify the metrics API server is running execute the below command and check
kubectl top nodes
Step 8: Refer here to install SingleAgent and start.
Once we start the agent it will be added to Applicare Console.
Step 9: Execute the below command one by one to get the Cluster IP and Token. Copy the $APISERVER and $TOKEN value for configuration.
APISERVER=$(kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}')
echo $APISERVER
SECRET_NAME=$(kubectl get sa applicare -o jsonpath='{.secrets[0].name}')
echo $SECRET_NAME
TOKEN=$(kubectl get secret $SECRET_NAME -o jsonpath='{.data.token}' | base64 --decode)
echo $TOKEN
Step 10: Login into Applicare console and go to Overview screen and select the newly added server and click Edit button.
Step 11: Enable the Add Kubernetes Monitoring checkbox and add the configuration details.
Step 12: Remove the "https:// (or) http://" in $APISERVER value and Paste the remaining value in ClusterIP field.
Step 12: Copy the $TOKEN value and paste it in Token field.
Step 13: Enter the Kubernetes running port in Port field.
Step 14: Select the Kubernetes protocol from the Protocol dropdown. Protocol details will be available in the $APISERVER. "https:// (or) http://"
Step 15: Click the Update button.
Note:
We can edit or delete the kubernetes configuration from both the Overview or Kubernetes menu.
Overview Menu
Update
Select the row and click Edit button and update the details and click Update button.
Delete
Select the row and click Edit button and Uncheck the Add the Kubernetes Monitoring checkbox and click Update button.
Kubernetes Menu
Update
Select the row and click Edit button and update the details and click Save button.
Delete
Select the row and click Delete button.
Comments
0 comments
Article is closed for comments.