-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support external OIDC identity provider #1483
Comments
Looking into docs this is using resource https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eks_identity_provider_config so you can achieve this outside module by just:
I don`t feel that making module complexity in this will be required as this can be done really easy. @antonbabenko @barryib any feelings here? |
Yes i am doing that now, the problem is it takes like 25-35 mins to associate and disassociate the identity provider increasing the overall time to build a new cluster and teardown it |
how embedding this into module will influence those timings? |
Currently this is done as post step after the cluster is built out, causing the api server to restart . I was wondering if we can hook this identity provider config as part of the cluster build rather than post step |
I don`t see any option (in webui) to add this during a creation, so seems you must first have cluster control planes available and then attach it. I don`t think there will be any way to make it faster as seems be AWS limitation. Does you have any other |
I also checked AWS API here https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html and here https://docs.aws.amazon.com/eks/latest/APIReference/API_AssociateIdentityProviderConfig.html so as per me there is no way to make this in other way than proposed initially |
For the time being, I don't see us adding even more resources like @bseenu I agree with this comment - #1483 (comment) - you should be able to accomplish this outside of the module. Closing this issue. |
I'm trying to achieve something like this, let me know if this is possible to achieve with this module in 2022. @antonbabenko
|
Lines 168 to 185 in 7d3c714
|
thanks @bryantbiggs I was able to replicate this but the problem with latest eks module's version is when I'm trying to execute it with the following code:
module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "18.21.0"
cluster_name = var.eks_cluster_name
cluster_version = var.kubernetes_version
enable_irsa = true
subnet_ids = module.vpc.private_subnets
cluster_endpoint_private_access = true
vpc_id = module.vpc.vpc_id
eks_managed_node_group_defaults = {
instance_types = var.node_instance_type
disk_size = var.node_ami_disk_size
ami_type = var.node_ami_type
}
eks_managed_node_groups = {
nodes = {
desired_size = var.nodes_desired_capacity
max_size = var.nodes_max_capacity
min_size = var.nodes_min_capacity
instance_types = var.node_instance_type
capacity_type = var.node_capacity_type
k8s_labels = {
Environment = "on_demand"
GithubRepo = "terraform-aws-eks"
GithubOrg = "terraform-aws-modules"
}
additional_tags = {
ExtraTag = "on_demand-node"
}
}
create_iam_role = true
create_cloudwatch_log_group = false
iam_role_use_name_prefix = false
}
}
data "aws_eks_cluster" "cluster" {
name = module.eks.cluster_id
}
data "aws_eks_cluster_auth" "cluster" {
name = module.eks.cluster_id
}
data "aws_iam_openid_connect_provider" "cluster_oidc_arn" {
arn = module.eks.oidc_provider_arn
}
data "aws_iam_openid_connect_provider" "cluster_oidc_url" {
url = module.eks.oidc_provider
} I'm getting the following error:
I struggled a lot with the "parent eks" module as well as with the child "eks-managed-node-group" module but can't figure this out. |
I think you have an indentation issue module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "18.21.0"
cluster_name = var.eks_cluster_name
cluster_version = var.kubernetes_version
enable_irsa = true
subnet_ids = module.vpc.private_subnets
cluster_endpoint_private_access = true
vpc_id = module.vpc.vpc_id
# This should be at cluster level
create_cloudwatch_log_group = false
# I don't know if you meant this for the cluster IAM role or the node IAM role, moved to cluster level
iam_role_use_name_prefix = false
eks_managed_node_group_defaults = {
instance_types = var.node_instance_type
disk_size = var.node_ami_disk_size
ami_type = var.node_ami_type
}
eks_managed_node_groups = {
nodes = {
desired_size = var.nodes_desired_capacity
max_size = var.nodes_max_capacity
min_size = var.nodes_min_capacity
instance_types = var.node_instance_type
capacity_type = var.node_capacity_type
k8s_labels = {
Environment = "on_demand"
GithubRepo = "terraform-aws-eks"
GithubOrg = "terraform-aws-modules"
}
additional_tags = {
ExtraTag = "on_demand-node"
}
}
}
} |
Thanks, @bryantbiggs for the quick resolution here, it was my bad that I hadn't double-checked the indentation of the block. But again I have another problem, while using the following: I'm getting the following error on
I checked in the aws console the same "URL" is being created under "OpenID Connect provider URL". Please let me know what I'm missing here. |
I would look it up using the ARN instead: data "aws_iam_openid_connect_provider" "this" {
arn = module.eks.oidc_provider_arn
} |
@bryantbiggs Oh I see but I'm trying to do achieve something like:
And "data sources" as:
Please let me know what I'm missing here. |
module "cluster_autoscaler_irsa_role" {
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
version = "~> 5.0"
role_name = "cluster-autoscaler"
attach_cluster_autoscaler_policy = true
cluster_autoscaler_cluster_ids = [module.eks.cluster_id]
oidc_providers = {
ex = {
provider_arn = module.eks.oidc_provider_arn
namespace_service_accounts = ["kube-system:cluster-autoscaler"]
}
}
tags = local.tags
} |
@bryantbiggs beautiful ❤️ Now, my only questions are:
|
This module does not provision cluster level resources (aws-auth configmap is the only cluster level management performed in this module). You can wrap the helm charts in the Terraform helm chart provider like https://github.com/clowdhaus/eks-reference-architecture/blob/e2a8cdc6405a4eff69bb6119ec57dc729f6ab8f1/karpenter/us-east-1/karpenter.tf#L37 or you can use a GitOps based approach with something like ArgoCD or Flux (would be the recommended way) |
@bryantbiggs thanks a ton for the help. I've one more query regarding "cluster version update" while using terraform and eks module I'm trying to change the existing k8s cluster version to a newer one but I'm not getting the expected behaviour. The problem here is the terraform's output on this particular activity. Please let me know if you can provide me with an explanation for this. |
You are probably missing some describe type permissions. Terraform has to poll and describe the cluster/resources while it waits for the update to complete |
@bryantbiggs Oh, I have the following permissions set for the IAM user. Not sure whether the rest (on the left are also required), the problem is there isn't any perfect list for required permissions at all. |
right, and the |
Got it, thanks a lot for the clarification. @bryantbiggs |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Is your request related to a new offering from AWS?
yes , aws now supports external oidc identity provider - https://aws.amazon.com/blogs/containers/introducing-oidc-identity-provider-authentication-amazon-eks/
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eks_identity_provider_config
Is your request related to a problem? Please describe.
I am trying associating the oidc identity provider as post step after the cluster is created and is taking a long time
ref: aws/containers-roadmap#1438
Describe the solution you'd like.
the external oidc provider is associated with the eks cluster during the build time so that the api server is not restarted to associate the oidc provider
The text was updated successfully, but these errors were encountered: