Helm chartv2.3.0App 3.2

Integrate AWS IAM with Kubernetes

About this chart

kiam

Installs kiam to integrate AWS IAM with Kubernetes.

TL;DR;

$ helm install <helm-repo>/kiam

$ helm install stable/kiam

Introduction

This chart bootstraps a kiam deployment on a Kubernetes cluster using the Helm package manager.

Prerequisites

  • Kubernetes 1.8+ with Beta APIs enabled

Installing the Chart

The chart generates a self signed TLS certificate by default. If you want to create and install your own, you can create TLS certificates and private keys as described here.

Tip: The hosts field in the kiam server certificate should include the value release-name-server:server-service-port, e.g. my-release-server:443

If you don't include the exact hostname used by the kiam agent to connect to the server, you'll see a warning (which is really an error) in the agent logs similar to the following, and your pods will fail to obtain credentials:

{"level":"warning","msg":"error finding role for pod: rpc error: code = Unavailable desc = there is no connection available","pod.ip":"100.120.0.2","time":"2018-05-24T04:11:25Z"}

Define values agent.tlsFiles.ca, agent.tlsFiles.cert, agent.tlsFiles.key, server.tlsFiles.ca, server.tlsFiles.cert and server.tlsFiles.key to be the base64-encoded contents (.e.g. using the base64 command) of the generated PEM files. For example

agent:
  tlsFiles:
    key: LS0tL...
    cert: LS0tL...
    ca: LS0tL...

server:
  tlsFiles:
    key: LS0tL...
    cert: LS0tL...
    ca: LS0tL...

Define secret name values agent.tlsSecret and server.tlsSecret if TLS certificates secrets have already created instead of tlsFiles.

agent:
  tlsSecret: kiam-agent-tls

server:
  tlsSecret: kiam-server-tls

Define TLS certificate names to use in kiam command line arguments as follows.

agent:
  tlsCerts:
    certFileName: cert
    keyFileName: key
    caFileName: ca

server:
  tlsCerts:
    certFileName: cert
    keyFileName: key
    caFileName: ca

To install the chart with the release name my-release:

$ helm install <helm-repo>/kiam --name my-release

$ helm install stable/kiam --name my-release The command deploys kiam on the Kubernetes cluster in the default configuration. The configuration section lists the parameters that can be configured during installation.

Uninstalling the Chart

To uninstall/delete the my-release deployment:

$ helm delete my-release

The command removes all the Kubernetes components associated with the chart and deletes the release.

Configuration

The following table lists the configurable parameters of the kiam chart and their default values.

ParameterDescriptionDefault
agent.enabledIf true, create agenttrue
agent.nameAgent container nameagent
agent.image.repositoryAgent imagequay.io/uswitch/kiam
agent.image.tagAgent image tagv3.2
agent.image.pullPolicyAgent image pull policyIfNotPresent
agent.dnsPolicyAgent pod DNS policyClusterFirstWithHostNet
agent.extraArgsAdditional agent container arguments{}
agent.extraEnvAdditional agent container environment variables{}
agent.extraHostPathMountsAdditional agent container hostPath mounts[]
agent.gatewayTimeoutCreationAgent's timeout when creating the kiam gateway50ms
agent.host.ipIP address of host$(HOST_IP)
agent.host.iptablesAdd iptables rulefalse
agent.host.interfaceAgent's host interface for proxying AWS metadatacali+
agent.host.portAgent's listening port8181
agent.log.jsonOutputWhether or not to output agent log in JSON formattrue
agent.log.levelAgent log level (debug, info, warn or error)info
agent.nodeSelectorNode labels for agent pod assignment{}
agent.prometheus.portAgent Prometheus metrics port9620
agent.prometheus.scrapeWhether or not Prometheus metrics for the agent should be scrapedtrue
agent.prometheus.syncIntervalAgent Prometheus synchronization interval5s
agent.podAnnotationsAnnotations to be added to agent pods{}
agent.podLabelsLabels to be added to agent pods{}
agent.priorityClassNameAgent pods priority class name""
agent.resourcesAgent container resources{}
agent.serviceAnnotationsAnnotations to be added to agent service{}
agent.serviceLabelsLabels to be added to agent service{}
agent.tlsSecretSecret name for the agent's TLS certificatesnull
agent.tlsFiles.caBase64 encoded string for the agent's CA certificate(s)null
agent.tlsFiles.certBase64 encoded strings for the agent's certificatenull
agent.tlsFiles.keyBase64 encoded strings for the agent's private keynull
agent.tolerationsTolerations to be applied to agent pods[]
agent.affinityNode affinity for pod assignment{}
agent.updateStrategyStrategy for agent DaemonSet updates (requires Kubernetes 1.6+)OnDelete
server.enabledIf true, create servertrue
server.nameServer container nameserver
server.gatewayTimeoutCreationServer's timeout when creating the kiam gateway50ms
server.image.repositoryServer imagequay.io/uswitch/kiam
server.image.tagServer image tagv3.2
server.image.pullPolicyServer image pull policyAlways
server.assumeRoleArnIAM role for the server to assume before processing requestsnull
server.cache.syncIntervalPod cache synchronization interval1m
server.extraArgsAdditional server container arguments{}
server.extraEnvAdditional server container environment variables{}
server.extraHostPathMountsAdditional server container hostPath mounts[]
server.log.jsonOutputWhether or not to output server log in JSON formattrue
server.log.levelServer log level (debug, info, warn or error)info
server.nodeSelectorNode labels for server pod assignment{}
server.prometheus.portServer Prometheus metrics port9620
server.prometheus.scrapeWhether or not Prometheus metrics for the server should be scrapedtrue
server.prometheus.syncIntervalServer Prometheus synchronization interval5s
server.podAnnotationsAnnotations to be added to server pods{}
server.podLabelsLabels to be added to server pods{}
server.probes.serverAddressAddress that readyness and liveness probes will hit127.0.0.1
server.priorityClassNameServer pods priority class name""
server.resourcesServer container resources{}
server.roleBaseArnBase ARN for IAM roles. If not specified use EC2 metadata service to detect ARN prefixnull
server.sessionDurationSession duration for STS tokens generated by the server15m
server.serviceAnnotationsAnnotations to be added to server service{}
server.serviceLabelsLabels to be added to server service{}
server.service.portServer service port443
server.service.targetPortServer service target port443
server.tlsSecretSecret name for the server's TLS certificatesnull
server.tlsFiles.caBase64 encoded string for the server's CA certificate(s)null
server.tlsFiles.certBase64 encoded strings for the server's certificatenull
server.tlsFiles.keyBase64 encoded strings for the server's private keynull
server.tolerationsTolerations to be applied to server pods[]
server.affinityNode affinity for pod assignment{}
server.updateStrategyStrategy for server DaemonSet updates (requires Kubernetes 1.6+)OnDelete
server.useHostNetworkIf true, use hostNetwork on server to bypass agent iptable rulesfalse
rbac.createIf true, create & use RBAC resourcestrue
serviceAccounts.agent.createIf true, create the agent service accounttrue
serviceAccounts.agent.nameName of the agent service account to use or create{{ kiam.agent.fullname }}
serviceAccounts.server.createIf true, create the server service accounttrue
serviceAccounts.server.nameName of the server service account to use or create{{ kiam.server.fullname }}

Specify each parameter using the --set key=value[,key=value] argument to helm install. For example,

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
$ helm install <helm-repo>/kiam --name my-release \
  --set=extraArgs.base-role-arn=arn:aws:iam::0123456789:role/,extraArgs.default-role=kube2iam-default,host.iptables=true,host.interface=cbr0

$ helm install stable/kiam --name my-release \

Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example,

$ helm install <helm-repo>/kiam --name my-release -f values.yaml

$ helm install stable/kiam --name my-release -f values.yaml

Tip: You can use the default values.yaml

Deploy kiam with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has kiam on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartkiam is pinned at v2.3.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply