How to setup Container Insights for AWS EKS with both EC2 Nodegroup and Fargate Profile?

0

I have an EKS cluster with both EC2 Nodegroup and Fargate Profile, and I want to setup Container Insights for both. I followed the docs, but I got error which tell that the default-scheduler failed to schedule fluent-bit on Fargate Profile. As I understand, it should be Fargate Scheduler launch fluent-bit as sidecar container into Fargate Pods.

Does anyone knows how to setup Container Insights for both EC2 Nodegroup and Fargate Profile? Thank you

hai
asked a year ago399 views
1 Answer
0

To setup Container Insights for both EC2 Nodegroup and Fargate Profile in your EKS cluster, you need to follow these steps:

  1. Enable Container Insights for your cluster by following the steps mentioned in the official AWS documentation: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Container-Insights-setup-EKS-quickstart.html
  2. Once you have enabled Container Insights, install the Fluent Bit log collector on your EC2 instances by running the following command:
kubectl apply -f https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container-insights/latest/k8s-yaml-templates/quickstart/cwagent-fluent-bit-quickstart.yaml
  1. Verify that the Fluent Bit log collector is running by checking the logs of the fluent-bit container in the amazon-cloudwatch namespace:
kubectl -n amazon-cloudwatch logs -f fluent-bit-xxxxx
  1. To enable Container Insights for Fargate profiles, you need to create a Fargate profile with the cwagent and cwlogs addons enabled. You can do this by creating a YAML file with the following contents:
apiVersion: eksctl.io/v1alpha5
kind: FargateProfile
metadata:
  name: my-fargate-profile
  region: <region>
  version: '1.17'
spec:
  selectors:
    - namespace: default
  subnets:
    - subnet-xxxxxxxx
  addons:
    - name: cwagent
      version: 'latest'
    - name: cwlogs
      version: 'latest'
  1. Apply the YAML file using the eksctl CLI tool:
eksctl create fargateprofile -f fargate-profile.yaml
  1. Verify that the Fluent Bit log collector is running as a sidecar container in your Fargate pods by checking the logs of the fluent-bit container in the amazon-cloudwatch namespace:
kubectl -n amazon-cloudwatch logs -f fluent-bit-xxxxx

By following these steps, you should be able to enable Container Insights for both EC2 Nodegroup and Fargate Profile in your EKS cluster.

hash
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions