mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-01-17 00:57:28 +01:00
Merge pull request #7 from terraform-aws-modules/fix/git_add_templates
forgot to add templates
This commit is contained in:
12
templates/config-map-aws-auth.yaml.tpl
Normal file
12
templates/config-map-aws-auth.yaml.tpl
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: aws-auth
|
||||
namespace: kube-system
|
||||
data:
|
||||
mapRoles: |
|
||||
- rolearn: ${role_arn}
|
||||
username: system:node:{{EC2PrivateDNSName}}
|
||||
groups:
|
||||
- system:bootstrappers
|
||||
- system:nodes
|
||||
27
templates/kubeconfig.tpl
Normal file
27
templates/kubeconfig.tpl
Normal file
@@ -0,0 +1,27 @@
|
||||
apiVersion: v1
|
||||
preferences: {}
|
||||
kind: Config
|
||||
|
||||
clusters:
|
||||
- cluster:
|
||||
server: ${endpoint}
|
||||
certificate-authority-data: ${cluster_auth_base64}
|
||||
name: kubernetes
|
||||
|
||||
contexts:
|
||||
- context:
|
||||
cluster: kubernetes
|
||||
user: aws
|
||||
name: aws
|
||||
current-context: aws
|
||||
|
||||
users:
|
||||
- name: aws
|
||||
user:
|
||||
exec:
|
||||
apiVersion: client.authentication.k8s.io/v1alpha1
|
||||
command: heptio-authenticator-aws
|
||||
args:
|
||||
- "token"
|
||||
- "-i"
|
||||
- "${cluster_name}"
|
||||
30
templates/userdata.sh.tpl
Normal file
30
templates/userdata.sh.tpl
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash -xe
|
||||
|
||||
# Certificate Authority config
|
||||
CA_CERTIFICATE_DIRECTORY=/etc/kubernetes/pki
|
||||
CA_CERTIFICATE_FILE_PATH=$CA_CERTIFICATE_DIRECTORY/ca.crt
|
||||
mkdir -p $CA_CERTIFICATE_DIRECTORY
|
||||
echo "${cluster_auth_base64}" | base64 -d >$CA_CERTIFICATE_FILE_PATH
|
||||
|
||||
# Authenticatoin
|
||||
INTERNAL_IP=$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4)
|
||||
sed -i s,MASTER_ENDPOINT,${endpoint},g /var/lib/kubelet/kubeconfig
|
||||
sed -i s,CLUSTER_NAME,${cluster_name},g /var/lib/kubelet/kubeconfig
|
||||
sed -i s,REGION,${region},g /etc/systemd/system/kubelet.service
|
||||
sed -i s,MAX_PODS,${max_pod_count},g /etc/systemd/system/kubelet.service
|
||||
sed -i s,MASTER_ENDPOINT,${endpoint},g /etc/systemd/system/kubelet.service
|
||||
sed -i s,INTERNAL_IP,$INTERNAL_IP,g /etc/systemd/system/kubelet.service
|
||||
|
||||
# DNS cluster configuration
|
||||
DNS_CLUSTER_IP=10.100.0.10
|
||||
if [[ $INTERNAL_IP == 10.* ]]; then DNS_CLUSTER_IP=172.20.0.10; fi
|
||||
sed -i s,DNS_CLUSTER_IP,$DNS_CLUSTER_IP,g /etc/systemd/system/kubelet.service
|
||||
sed -i s,CERTIFICATE_AUTHORITY_FILE,$CA_CERTIFICATE_FILE_PATH,g /var/lib/kubelet/kubeconfig
|
||||
sed -i s,CLIENT_CA_FILE,$CA_CERTIFICATE_FILE_PATH,g /etc/systemd/system/kubelet.service
|
||||
|
||||
# start services
|
||||
systemctl daemon-reload
|
||||
systemctl restart kubelet kube-proxy
|
||||
|
||||
# Allow user supplied userdata code
|
||||
${additional_userdata}
|
||||
Reference in New Issue
Block a user