Amazon EKS Pod Identity Webhook
Amazon EKS Pod Identity Webhook
This webhook is for mutating pods that will require AWS IAM access.
After version v0.3.0, --in-cluster=true no longer works and is deprecated. Please use --in-cluster=false
and manage the cluster certificate with cert-manager or some other external certificate provisioning system.
This is because certificates using the legacy-unknown signer are no longer signed when using the v1
certificates API.
aws eks describe-cluster --name $CLUSTER_NAME --query cluster.identity.oidc………To ensure workloads are scheduled on windows nodes have the right environment variables, they must have a nodeSelector targeting windows it must run on. Workloads targeting windows nodes using nodeAffinity are currently not supported.
nodeSelector:
beta.kubernetes.io/os: windowsOr for Kubernetes 1.14+
nodeSelector:
kubernetes.io/os: windowsWhen running a container with a non-root user, you need to give the container access to the token file by setting the fsGroup field in the securityContext object.
…When the aws-default-region flag is set this webhook will inject AWS_DEFAULT_REGION and AWS_REGION in mutated containers if AWS_DEFAULT_REGION and AWS_REGION are not already set.
When the sts-regional-endpoint flag is set to true, the webhook will
inject the environment variable AWS_STS_REGIONAL_ENDPOINTS with the value set
to regional. This environment variable will configure the AWS SDKs to perform
the sts:AssumeRoleWithWebIdentity call to get credentials from the regional
endpoint, instead of the global endpoint in us-east-1. This is desirable in
almost all cases, unless the STS regional endpoint is disabled in your
account.
You can also enable this per-service account with the annotation
eks.amazonaws.com/sts-regional-endpoints set to "true".
The purpose of the pod-identity-webhook ConfigMap is to simplify the mapping of IAM roles and ServiceAccount
when using tools/installers like kOps that directly manage IAM roles and trust policies. When using these tools,
users do not need to configure annotations on the ServiceAccounts as the tools already know the relationship can relay it to the webhook.
When the watch-config-map flag is set to true, the webhook will watch the
pod-identity-webhook ConfigMap in the namespace configured by the --namespace flag
for additional ServiceAccounts. The webhook will mutate Pods configured to use these
ServiceAccounts even if they have no annotations.
Should the same ServiceAccount both be referenced both in the ConfigMap and have annotations, the annotations takes presedence.
Here is an example ConfigMap:
…Container images for amazon-eks-pod-identity-webhook can be found on ECR.
You must install cert-manager as it is a pre-requisite for below deployments. (See cert-manager installation)
You can use the provided configuration files in the deploy directory, along with the provided Makefile.
make cluster-up IMAGE=amazon/amazon-eks-pod-identity-webhook:latestThis will:
in-cluster=false so that the webhook reloads certificates from the filesystem rather than creating CSRs to request certificates (using CSRs is now deprecated and will not work versions later than v0.3.0).For self-hosted API server configuration, see see SELF_HOSTED_SETUP.md
TODO
With the upgrade to client-go 1.18, certificate_manager_server_expiration_seconds metric has been removed by an upstream commit kubernetes/kubernetes#85874. A new metric certificate_manager_server_rotation_seconds is added which tracks the time a certificate was valid before getting rotated.
Apache 2.0 - Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. See LICENSE
No open issues yet, or sync has not completed.