EKS Is best to use oidc_providers ?

I am trying to deploy EKS, but i don’t understand why i need OIDC ?

Is best practice to use this ? I don’t need connection with IAM or AD.

But from terraform i need to have this code, Not sure how i can avoid that or i really need that.

module “vpc_cni_irsa” {
source = “terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks”
version = “~> 5.0”

  role_name_prefix      = "VPC-CNI-IRSA"
  attach_vpc_cni_policy = true
  vpc_cni_enable_ipv6   = true

  oidc_providers = {
    main = {
      provider_arn               = module.eks.oidc_provider_arn
      namespace_service_accounts = ["kube-system:aws-node"]
    }
  }
}

Is it really required? Seems like cni requires a service account, id like to know as well.

The VPC CNI requires AWS permissions. Since everything running on an instance in theory inherits the permissions provided to the IAM role/profile of the instance, it’s recommended to move those permissions into an IAM role for service accounts (IRSA) and assign that role to the pods to follow the principles of least privilege

So you can assign the permissions to the instances or you can use IRSA to assign them to the appropriate pods - either way, the VPC CNI requires AWS permissions to function

Oidc in eks is most often used to allow a pod access to aws api, for examle to be able to read info or create a new aws resources. Imagine that you have an app running in eks tha needs access to S3 bucket. You setup a sevice-account in eks, run the pod with that sa, create a IAM role with required permissions for accessing s3 bucket, and allow that role to be assumed by the previously created service-account. In that assuming the role oidc is used

You need an OIDC provider in order for IRSA to work. In other words: if none of your applications is accessing any AWS APIs (for example, uploading a file to an S3 bucket) then you don’t need it.