mirror of https://github.com/kubernetes/kops.git
hack/update-expected.sh
This commit is contained in:
parent
3ce8dd165b
commit
1b03e7237b
|
|
@ -4,8 +4,16 @@
|
|||
"Type": "AWS::AutoScaling::AutoScalingGroup",
|
||||
"Properties": {
|
||||
"AutoScalingGroupName": "master-us-test-1b.masters.additionalcidr.example.com",
|
||||
"LaunchConfigurationName": {
|
||||
"Ref": "AWSAutoScalingLaunchConfigurationmasterustest1bmastersadditionalcidrexamplecom"
|
||||
"LaunchTemplate": {
|
||||
"LaunchTemplateId": {
|
||||
"Ref": "AWSEC2LaunchTemplatemasterustest1bmastersadditionalcidrexamplecom"
|
||||
},
|
||||
"Version": {
|
||||
"Fn::GetAtt": [
|
||||
"AWSEC2LaunchTemplatemasterustest1bmastersadditionalcidrexamplecom",
|
||||
"LatestVersionNumber"
|
||||
]
|
||||
}
|
||||
},
|
||||
"MaxSize": 1,
|
||||
"MinSize": 1,
|
||||
|
|
@ -62,8 +70,16 @@
|
|||
"Type": "AWS::AutoScaling::AutoScalingGroup",
|
||||
"Properties": {
|
||||
"AutoScalingGroupName": "nodes.additionalcidr.example.com",
|
||||
"LaunchConfigurationName": {
|
||||
"Ref": "AWSAutoScalingLaunchConfigurationnodesadditionalcidrexamplecom"
|
||||
"LaunchTemplate": {
|
||||
"LaunchTemplateId": {
|
||||
"Ref": "AWSEC2LaunchTemplatenodesadditionalcidrexamplecom"
|
||||
},
|
||||
"Version": {
|
||||
"Fn::GetAtt": [
|
||||
"AWSEC2LaunchTemplatenodesadditionalcidrexamplecom",
|
||||
"LatestVersionNumber"
|
||||
]
|
||||
}
|
||||
},
|
||||
"MaxSize": 2,
|
||||
"MinSize": 2,
|
||||
|
|
@ -116,68 +132,6 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"AWSAutoScalingLaunchConfigurationmasterustest1bmastersadditionalcidrexamplecom": {
|
||||
"Type": "AWS::AutoScaling::LaunchConfiguration",
|
||||
"Properties": {
|
||||
"AssociatePublicIpAddress": true,
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 64,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeviceName": "/dev/sdc",
|
||||
"VirtualName": "ephemeral0"
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Ref": "AWSIAMInstanceProfilemastersadditionalcidrexamplecom"
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "m3.medium",
|
||||
"KeyName": "kubernetes.additionalcidr.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"SecurityGroups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupmastersadditionalcidrexamplecom"
|
||||
}
|
||||
],
|
||||
"UserData": "extracted",
|
||||
"InstanceMonitoring": false
|
||||
}
|
||||
},
|
||||
"AWSAutoScalingLaunchConfigurationnodesadditionalcidrexamplecom": {
|
||||
"Type": "AWS::AutoScaling::LaunchConfiguration",
|
||||
"Properties": {
|
||||
"AssociatePublicIpAddress": true,
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 128,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Ref": "AWSIAMInstanceProfilenodesadditionalcidrexamplecom"
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "t2.medium",
|
||||
"KeyName": "kubernetes.additionalcidr.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"SecurityGroups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupnodesadditionalcidrexamplecom"
|
||||
}
|
||||
],
|
||||
"UserData": "extracted",
|
||||
"InstanceMonitoring": false
|
||||
}
|
||||
},
|
||||
"AWSEC2DHCPOptionsadditionalcidrexamplecom": {
|
||||
"Type": "AWS::EC2::DHCPOptions",
|
||||
"Properties": {
|
||||
|
|
@ -220,6 +174,192 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"AWSEC2LaunchTemplatemasterustest1bmastersadditionalcidrexamplecom": {
|
||||
"Type": "AWS::EC2::LaunchTemplate",
|
||||
"Properties": {
|
||||
"LaunchTemplateName": "master-us-test-1b.masters.additionalcidr.example.com",
|
||||
"LaunchTemplateData": {
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 64,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeviceName": "/dev/sdc",
|
||||
"VirtualName": "ephemeral0"
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Name": {
|
||||
"Ref": "AWSIAMInstanceProfilemastersadditionalcidrexamplecom"
|
||||
}
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "m3.medium",
|
||||
"KeyName": "kubernetes.additionalcidr.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"NetworkInterfaces": [
|
||||
{
|
||||
"AssociatePublicIpAddress": true,
|
||||
"DeleteOnTermination": true,
|
||||
"DeviceIndex": 0,
|
||||
"Groups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupmastersadditionalcidrexamplecom"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"TagSpecifications": [
|
||||
{
|
||||
"ResourceType": "instance",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "additionalcidr.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "master-us-test-1b.masters.additionalcidr.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/master",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "master-us-test-1b"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/additionalcidr.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ResourceType": "volume",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "additionalcidr.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "master-us-test-1b.masters.additionalcidr.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/master",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "master-us-test-1b"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/additionalcidr.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"UserData": "extracted"
|
||||
}
|
||||
}
|
||||
},
|
||||
"AWSEC2LaunchTemplatenodesadditionalcidrexamplecom": {
|
||||
"Type": "AWS::EC2::LaunchTemplate",
|
||||
"Properties": {
|
||||
"LaunchTemplateName": "nodes.additionalcidr.example.com",
|
||||
"LaunchTemplateData": {
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 128,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Name": {
|
||||
"Ref": "AWSIAMInstanceProfilenodesadditionalcidrexamplecom"
|
||||
}
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "t2.medium",
|
||||
"KeyName": "kubernetes.additionalcidr.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"NetworkInterfaces": [
|
||||
{
|
||||
"AssociatePublicIpAddress": true,
|
||||
"DeleteOnTermination": true,
|
||||
"DeviceIndex": 0,
|
||||
"Groups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupnodesadditionalcidrexamplecom"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"TagSpecifications": [
|
||||
{
|
||||
"ResourceType": "instance",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "additionalcidr.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "nodes.additionalcidr.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/node",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "nodes"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/additionalcidr.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ResourceType": "volume",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "additionalcidr.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "nodes.additionalcidr.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/node",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "nodes"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/additionalcidr.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"UserData": "extracted"
|
||||
}
|
||||
}
|
||||
},
|
||||
"AWSEC2Route00000": {
|
||||
"Type": "AWS::EC2::Route",
|
||||
"Properties": {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Resources.AWSAutoScalingLaunchConfigurationmasterustest1bmastersadditionalcidrexamplecom.Properties.UserData: |
|
||||
Resources.AWSEC2LaunchTemplatemasterustest1bmastersadditionalcidrexamplecom.Properties.LaunchTemplateData.UserData: |
|
||||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
|
|
@ -301,7 +301,7 @@ Resources.AWSAutoScalingLaunchConfigurationmasterustest1bmastersadditionalcidrex
|
|||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
Resources.AWSAutoScalingLaunchConfigurationnodesadditionalcidrexamplecom.Properties.UserData: |
|
||||
Resources.AWSEC2LaunchTemplatenodesadditionalcidrexamplecom.Properties.LaunchTemplateData.UserData: |
|
||||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -1,302 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
encryptionConfig: null
|
||||
etcdClusters:
|
||||
events:
|
||||
version: 3.3.10
|
||||
main:
|
||||
version: 3.3.10
|
||||
kubeAPIServer:
|
||||
allowPrivileged: true
|
||||
anonymousAuth: false
|
||||
apiServerCount: 3
|
||||
authorizationMode: AlwaysAllow
|
||||
bindAddress: 0.0.0.0
|
||||
cloudProvider: aws
|
||||
enableAdmissionPlugins:
|
||||
- NamespaceLifecycle
|
||||
- LimitRanger
|
||||
- ServiceAccount
|
||||
- PersistentVolumeLabel
|
||||
- DefaultStorageClass
|
||||
- DefaultTolerationSeconds
|
||||
- MutatingAdmissionWebhook
|
||||
- ValidatingAdmissionWebhook
|
||||
- NodeRestriction
|
||||
- ResourceQuota
|
||||
etcdServers:
|
||||
- http://127.0.0.1:4001
|
||||
etcdServersOverrides:
|
||||
- /events#http://127.0.0.1:4002
|
||||
image: k8s.gcr.io/kube-apiserver:v1.14.0
|
||||
insecureBindAddress: 127.0.0.1
|
||||
insecurePort: 8080
|
||||
kubeletPreferredAddressTypes:
|
||||
- InternalIP
|
||||
- Hostname
|
||||
- ExternalIP
|
||||
logLevel: 2
|
||||
requestheaderAllowedNames:
|
||||
- aggregator
|
||||
requestheaderExtraHeaderPrefixes:
|
||||
- X-Remote-Extra-
|
||||
requestheaderGroupHeaders:
|
||||
- X-Remote-Group
|
||||
requestheaderUsernameHeaders:
|
||||
- X-Remote-User
|
||||
securePort: 443
|
||||
serviceClusterIPRange: 100.64.0.0/13
|
||||
storageBackend: etcd3
|
||||
kubeControllerManager:
|
||||
allocateNodeCIDRs: true
|
||||
attachDetachReconcileSyncPeriod: 1m0s
|
||||
cloudProvider: aws
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
clusterName: additionalcidr.example.com
|
||||
configureCloudRoutes: true
|
||||
image: k8s.gcr.io/kube-controller-manager:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
useServiceAccountCredentials: true
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubeScheduler:
|
||||
image: k8s.gcr.io/kube-scheduler:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
masterKubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
registerSchedulable: false
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: additionalcidr.example.com
|
||||
ConfigBase: memfs://clusters.example.com/additionalcidr.example.com
|
||||
InstanceGroupName: master-us-test-1a
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/additionalcidr.example.com/addons/bootstrap-channel.yaml
|
||||
etcdManifests:
|
||||
- memfs://clusters.example.com/additionalcidr.example.com/manifests/etcd/main.yaml
|
||||
- memfs://clusters.example.com/additionalcidr.example.com/manifests/etcd/events.yaml
|
||||
protokubeImage:
|
||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
||||
name: protokube:1.15.0
|
||||
sources:
|
||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
||||
- https://github.com/kubernetes/kops/releases/download/v1.15.0/images-protokube.tar.gz
|
||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
|
|
@ -1,302 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
encryptionConfig: null
|
||||
etcdClusters:
|
||||
events:
|
||||
version: 3.3.10
|
||||
main:
|
||||
version: 3.3.10
|
||||
kubeAPIServer:
|
||||
allowPrivileged: true
|
||||
anonymousAuth: false
|
||||
apiServerCount: 3
|
||||
authorizationMode: AlwaysAllow
|
||||
bindAddress: 0.0.0.0
|
||||
cloudProvider: aws
|
||||
enableAdmissionPlugins:
|
||||
- NamespaceLifecycle
|
||||
- LimitRanger
|
||||
- ServiceAccount
|
||||
- PersistentVolumeLabel
|
||||
- DefaultStorageClass
|
||||
- DefaultTolerationSeconds
|
||||
- MutatingAdmissionWebhook
|
||||
- ValidatingAdmissionWebhook
|
||||
- NodeRestriction
|
||||
- ResourceQuota
|
||||
etcdServers:
|
||||
- http://127.0.0.1:4001
|
||||
etcdServersOverrides:
|
||||
- /events#http://127.0.0.1:4002
|
||||
image: k8s.gcr.io/kube-apiserver:v1.14.0
|
||||
insecureBindAddress: 127.0.0.1
|
||||
insecurePort: 8080
|
||||
kubeletPreferredAddressTypes:
|
||||
- InternalIP
|
||||
- Hostname
|
||||
- ExternalIP
|
||||
logLevel: 2
|
||||
requestheaderAllowedNames:
|
||||
- aggregator
|
||||
requestheaderExtraHeaderPrefixes:
|
||||
- X-Remote-Extra-
|
||||
requestheaderGroupHeaders:
|
||||
- X-Remote-Group
|
||||
requestheaderUsernameHeaders:
|
||||
- X-Remote-User
|
||||
securePort: 443
|
||||
serviceClusterIPRange: 100.64.0.0/13
|
||||
storageBackend: etcd3
|
||||
kubeControllerManager:
|
||||
allocateNodeCIDRs: true
|
||||
attachDetachReconcileSyncPeriod: 1m0s
|
||||
cloudProvider: aws
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
clusterName: additionalcidr.example.com
|
||||
configureCloudRoutes: true
|
||||
image: k8s.gcr.io/kube-controller-manager:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
useServiceAccountCredentials: true
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubeScheduler:
|
||||
image: k8s.gcr.io/kube-scheduler:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
masterKubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
registerSchedulable: false
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: additionalcidr.example.com
|
||||
ConfigBase: memfs://clusters.example.com/additionalcidr.example.com
|
||||
InstanceGroupName: master-us-test-1b
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/additionalcidr.example.com/addons/bootstrap-channel.yaml
|
||||
etcdManifests:
|
||||
- memfs://clusters.example.com/additionalcidr.example.com/manifests/etcd/main.yaml
|
||||
- memfs://clusters.example.com/additionalcidr.example.com/manifests/etcd/events.yaml
|
||||
protokubeImage:
|
||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
||||
name: protokube:1.15.0
|
||||
sources:
|
||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
||||
- https://github.com/kubernetes/kops/releases/download/v1.15.0/images-protokube.tar.gz
|
||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
|
|
@ -1,302 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
encryptionConfig: null
|
||||
etcdClusters:
|
||||
events:
|
||||
version: 3.3.10
|
||||
main:
|
||||
version: 3.3.10
|
||||
kubeAPIServer:
|
||||
allowPrivileged: true
|
||||
anonymousAuth: false
|
||||
apiServerCount: 3
|
||||
authorizationMode: AlwaysAllow
|
||||
bindAddress: 0.0.0.0
|
||||
cloudProvider: aws
|
||||
enableAdmissionPlugins:
|
||||
- NamespaceLifecycle
|
||||
- LimitRanger
|
||||
- ServiceAccount
|
||||
- PersistentVolumeLabel
|
||||
- DefaultStorageClass
|
||||
- DefaultTolerationSeconds
|
||||
- MutatingAdmissionWebhook
|
||||
- ValidatingAdmissionWebhook
|
||||
- NodeRestriction
|
||||
- ResourceQuota
|
||||
etcdServers:
|
||||
- http://127.0.0.1:4001
|
||||
etcdServersOverrides:
|
||||
- /events#http://127.0.0.1:4002
|
||||
image: k8s.gcr.io/kube-apiserver:v1.14.0
|
||||
insecureBindAddress: 127.0.0.1
|
||||
insecurePort: 8080
|
||||
kubeletPreferredAddressTypes:
|
||||
- InternalIP
|
||||
- Hostname
|
||||
- ExternalIP
|
||||
logLevel: 2
|
||||
requestheaderAllowedNames:
|
||||
- aggregator
|
||||
requestheaderExtraHeaderPrefixes:
|
||||
- X-Remote-Extra-
|
||||
requestheaderGroupHeaders:
|
||||
- X-Remote-Group
|
||||
requestheaderUsernameHeaders:
|
||||
- X-Remote-User
|
||||
securePort: 443
|
||||
serviceClusterIPRange: 100.64.0.0/13
|
||||
storageBackend: etcd3
|
||||
kubeControllerManager:
|
||||
allocateNodeCIDRs: true
|
||||
attachDetachReconcileSyncPeriod: 1m0s
|
||||
cloudProvider: aws
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
clusterName: additionalcidr.example.com
|
||||
configureCloudRoutes: true
|
||||
image: k8s.gcr.io/kube-controller-manager:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
useServiceAccountCredentials: true
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubeScheduler:
|
||||
image: k8s.gcr.io/kube-scheduler:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
masterKubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
registerSchedulable: false
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: additionalcidr.example.com
|
||||
ConfigBase: memfs://clusters.example.com/additionalcidr.example.com
|
||||
InstanceGroupName: master-us-test-1c
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/additionalcidr.example.com/addons/bootstrap-channel.yaml
|
||||
etcdManifests:
|
||||
- memfs://clusters.example.com/additionalcidr.example.com/manifests/etcd/main.yaml
|
||||
- memfs://clusters.example.com/additionalcidr.example.com/manifests/etcd/events.yaml
|
||||
protokubeImage:
|
||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
||||
name: protokube:1.15.0
|
||||
sources:
|
||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
||||
- https://github.com/kubernetes/kops/releases/download/v1.15.0/images-protokube.tar.gz
|
||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
|
|
@ -1,209 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: additionalcidr.example.com
|
||||
ConfigBase: memfs://clusters.example.com/additionalcidr.example.com
|
||||
InstanceGroupName: nodes
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/additionalcidr.example.com/addons/bootstrap-channel.yaml
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -91,12 +91,15 @@ provider "aws" {
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "master-us-test-1a-masters-additionalcidr-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.master-us-test-1a-masters-additionalcidr-example-com.id
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1a.masters.additionalcidr.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.master-us-test-1a-masters-additionalcidr-example-com.id
|
||||
version = aws_launch_template.master-us-test-1a-masters-additionalcidr-example-com.latest_version
|
||||
}
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1a.masters.additionalcidr.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -126,12 +129,15 @@ resource "aws_autoscaling_group" "master-us-test-1a-masters-additionalcidr-examp
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "master-us-test-1b-masters-additionalcidr-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.master-us-test-1b-masters-additionalcidr-example-com.id
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1b.masters.additionalcidr.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.master-us-test-1b-masters-additionalcidr-example-com.id
|
||||
version = aws_launch_template.master-us-test-1b-masters-additionalcidr-example-com.latest_version
|
||||
}
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1b.masters.additionalcidr.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -161,12 +167,15 @@ resource "aws_autoscaling_group" "master-us-test-1b-masters-additionalcidr-examp
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "master-us-test-1c-masters-additionalcidr-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.master-us-test-1c-masters-additionalcidr-example-com.id
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1c.masters.additionalcidr.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.master-us-test-1c-masters-additionalcidr-example-com.id
|
||||
version = aws_launch_template.master-us-test-1c-masters-additionalcidr-example-com.latest_version
|
||||
}
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1c.masters.additionalcidr.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -196,12 +205,15 @@ resource "aws_autoscaling_group" "master-us-test-1c-masters-additionalcidr-examp
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "nodes-additionalcidr-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.nodes-additionalcidr-example-com.id
|
||||
max_size = 2
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 2
|
||||
name = "nodes.additionalcidr.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.nodes-additionalcidr-example-com.id
|
||||
version = aws_launch_template.nodes-additionalcidr-example-com.latest_version
|
||||
}
|
||||
max_size = 2
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 2
|
||||
name = "nodes.additionalcidr.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -360,96 +372,204 @@ resource "aws_key_pair" "kubernetes-additionalcidr-example-com-c4a6ed9aa889b9e2c
|
|||
public_key = file("${path.module}/data/aws_key_pair_kubernetes.additionalcidr.example.com-c4a6ed9aa889b9e2c39cd663eb9c7157_public_key")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "master-us-test-1a-masters-additionalcidr-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
ephemeral_block_device {
|
||||
resource "aws_launch_template" "master-us-test-1a-masters-additionalcidr-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
block_device_mappings {
|
||||
device_name = "/dev/sdc"
|
||||
virtual_name = "ephemeral0"
|
||||
}
|
||||
iam_instance_profile = aws_iam_instance_profile.masters-additionalcidr-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-additionalcidr-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.masters-additionalcidr-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-additionalcidr-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "master-us-test-1a.masters.additionalcidr.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.masters-additionalcidr-example-com.id]
|
||||
}
|
||||
security_groups = [aws_security_group.masters-additionalcidr-example-com.id]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_master-us-test-1a.masters.additionalcidr.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "additionalcidr.example.com"
|
||||
"Name" = "master-us-test-1a.masters.additionalcidr.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/additionalcidr.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "additionalcidr.example.com"
|
||||
"Name" = "master-us-test-1a.masters.additionalcidr.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/additionalcidr.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_master-us-test-1a.masters.additionalcidr.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "master-us-test-1b-masters-additionalcidr-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
ephemeral_block_device {
|
||||
resource "aws_launch_template" "master-us-test-1b-masters-additionalcidr-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
block_device_mappings {
|
||||
device_name = "/dev/sdc"
|
||||
virtual_name = "ephemeral0"
|
||||
}
|
||||
iam_instance_profile = aws_iam_instance_profile.masters-additionalcidr-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-additionalcidr-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.masters-additionalcidr-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-additionalcidr-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "master-us-test-1b.masters.additionalcidr.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.masters-additionalcidr-example-com.id]
|
||||
}
|
||||
security_groups = [aws_security_group.masters-additionalcidr-example-com.id]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_master-us-test-1b.masters.additionalcidr.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "additionalcidr.example.com"
|
||||
"Name" = "master-us-test-1b.masters.additionalcidr.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1b"
|
||||
"kubernetes.io/cluster/additionalcidr.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "additionalcidr.example.com"
|
||||
"Name" = "master-us-test-1b.masters.additionalcidr.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1b"
|
||||
"kubernetes.io/cluster/additionalcidr.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_master-us-test-1b.masters.additionalcidr.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "master-us-test-1c-masters-additionalcidr-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
ephemeral_block_device {
|
||||
resource "aws_launch_template" "master-us-test-1c-masters-additionalcidr-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
block_device_mappings {
|
||||
device_name = "/dev/sdc"
|
||||
virtual_name = "ephemeral0"
|
||||
}
|
||||
iam_instance_profile = aws_iam_instance_profile.masters-additionalcidr-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-additionalcidr-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.masters-additionalcidr-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-additionalcidr-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "master-us-test-1c.masters.additionalcidr.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.masters-additionalcidr-example-com.id]
|
||||
}
|
||||
security_groups = [aws_security_group.masters-additionalcidr-example-com.id]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_master-us-test-1c.masters.additionalcidr.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "additionalcidr.example.com"
|
||||
"Name" = "master-us-test-1c.masters.additionalcidr.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1c"
|
||||
"kubernetes.io/cluster/additionalcidr.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "additionalcidr.example.com"
|
||||
"Name" = "master-us-test-1c.masters.additionalcidr.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1c"
|
||||
"kubernetes.io/cluster/additionalcidr.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_master-us-test-1c.masters.additionalcidr.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "nodes-additionalcidr-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
iam_instance_profile = aws_iam_instance_profile.nodes-additionalcidr-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t2.medium"
|
||||
key_name = aws_key_pair.kubernetes-additionalcidr-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
resource "aws_launch_template" "nodes-additionalcidr-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 128
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.nodes-additionalcidr-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t2.medium"
|
||||
key_name = aws_key_pair.kubernetes-additionalcidr-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "nodes.additionalcidr.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 128
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.nodes-additionalcidr-example-com.id]
|
||||
}
|
||||
security_groups = [aws_security_group.nodes-additionalcidr-example-com.id]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_nodes.additionalcidr.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "additionalcidr.example.com"
|
||||
"Name" = "nodes.additionalcidr.example.com"
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/additionalcidr.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "additionalcidr.example.com"
|
||||
"Name" = "nodes.additionalcidr.example.com"
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/additionalcidr.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_nodes.additionalcidr.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_route_table_association" "us-test-1a-additionalcidr-example-com" {
|
||||
|
|
|
|||
|
|
@ -4,8 +4,16 @@
|
|||
"Type": "AWS::AutoScaling::AutoScalingGroup",
|
||||
"Properties": {
|
||||
"AutoScalingGroupName": "master-us-test-1a.masters.additionaluserdata.example.com",
|
||||
"LaunchConfigurationName": {
|
||||
"Ref": "AWSAutoScalingLaunchConfigurationmasterustest1amastersadditionaluserdataexamplecom"
|
||||
"LaunchTemplate": {
|
||||
"LaunchTemplateId": {
|
||||
"Ref": "AWSEC2LaunchTemplatemasterustest1amastersadditionaluserdataexamplecom"
|
||||
},
|
||||
"Version": {
|
||||
"Fn::GetAtt": [
|
||||
"AWSEC2LaunchTemplatemasterustest1amastersadditionaluserdataexamplecom",
|
||||
"LatestVersionNumber"
|
||||
]
|
||||
}
|
||||
},
|
||||
"MaxSize": 1,
|
||||
"MinSize": 1,
|
||||
|
|
@ -62,8 +70,16 @@
|
|||
"Type": "AWS::AutoScaling::AutoScalingGroup",
|
||||
"Properties": {
|
||||
"AutoScalingGroupName": "nodes.additionaluserdata.example.com",
|
||||
"LaunchConfigurationName": {
|
||||
"Ref": "AWSAutoScalingLaunchConfigurationnodesadditionaluserdataexamplecom"
|
||||
"LaunchTemplate": {
|
||||
"LaunchTemplateId": {
|
||||
"Ref": "AWSEC2LaunchTemplatenodesadditionaluserdataexamplecom"
|
||||
},
|
||||
"Version": {
|
||||
"Fn::GetAtt": [
|
||||
"AWSEC2LaunchTemplatenodesadditionaluserdataexamplecom",
|
||||
"LatestVersionNumber"
|
||||
]
|
||||
}
|
||||
},
|
||||
"MaxSize": 2,
|
||||
"MinSize": 2,
|
||||
|
|
@ -116,68 +132,6 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"AWSAutoScalingLaunchConfigurationmasterustest1amastersadditionaluserdataexamplecom": {
|
||||
"Type": "AWS::AutoScaling::LaunchConfiguration",
|
||||
"Properties": {
|
||||
"AssociatePublicIpAddress": true,
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 64,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeviceName": "/dev/sdc",
|
||||
"VirtualName": "ephemeral0"
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Ref": "AWSIAMInstanceProfilemastersadditionaluserdataexamplecom"
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "m3.medium",
|
||||
"KeyName": "kubernetes.additionaluserdata.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"SecurityGroups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupmastersadditionaluserdataexamplecom"
|
||||
}
|
||||
],
|
||||
"UserData": "extracted",
|
||||
"InstanceMonitoring": false
|
||||
}
|
||||
},
|
||||
"AWSAutoScalingLaunchConfigurationnodesadditionaluserdataexamplecom": {
|
||||
"Type": "AWS::AutoScaling::LaunchConfiguration",
|
||||
"Properties": {
|
||||
"AssociatePublicIpAddress": true,
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 128,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Ref": "AWSIAMInstanceProfilenodesadditionaluserdataexamplecom"
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "t2.medium",
|
||||
"KeyName": "kubernetes.additionaluserdata.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"SecurityGroups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupnodesadditionaluserdataexamplecom"
|
||||
}
|
||||
],
|
||||
"UserData": "extracted",
|
||||
"InstanceMonitoring": false
|
||||
}
|
||||
},
|
||||
"AWSEC2DHCPOptionsadditionaluserdataexamplecom": {
|
||||
"Type": "AWS::EC2::DHCPOptions",
|
||||
"Properties": {
|
||||
|
|
@ -220,6 +174,192 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"AWSEC2LaunchTemplatemasterustest1amastersadditionaluserdataexamplecom": {
|
||||
"Type": "AWS::EC2::LaunchTemplate",
|
||||
"Properties": {
|
||||
"LaunchTemplateName": "master-us-test-1a.masters.additionaluserdata.example.com",
|
||||
"LaunchTemplateData": {
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 64,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeviceName": "/dev/sdc",
|
||||
"VirtualName": "ephemeral0"
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Name": {
|
||||
"Ref": "AWSIAMInstanceProfilemastersadditionaluserdataexamplecom"
|
||||
}
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "m3.medium",
|
||||
"KeyName": "kubernetes.additionaluserdata.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"NetworkInterfaces": [
|
||||
{
|
||||
"AssociatePublicIpAddress": true,
|
||||
"DeleteOnTermination": true,
|
||||
"DeviceIndex": 0,
|
||||
"Groups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupmastersadditionaluserdataexamplecom"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"TagSpecifications": [
|
||||
{
|
||||
"ResourceType": "instance",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "additionaluserdata.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "master-us-test-1a.masters.additionaluserdata.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/master",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "master-us-test-1a"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/additionaluserdata.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ResourceType": "volume",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "additionaluserdata.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "master-us-test-1a.masters.additionaluserdata.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/master",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "master-us-test-1a"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/additionaluserdata.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"UserData": "extracted"
|
||||
}
|
||||
}
|
||||
},
|
||||
"AWSEC2LaunchTemplatenodesadditionaluserdataexamplecom": {
|
||||
"Type": "AWS::EC2::LaunchTemplate",
|
||||
"Properties": {
|
||||
"LaunchTemplateName": "nodes.additionaluserdata.example.com",
|
||||
"LaunchTemplateData": {
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 128,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Name": {
|
||||
"Ref": "AWSIAMInstanceProfilenodesadditionaluserdataexamplecom"
|
||||
}
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "t2.medium",
|
||||
"KeyName": "kubernetes.additionaluserdata.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"NetworkInterfaces": [
|
||||
{
|
||||
"AssociatePublicIpAddress": true,
|
||||
"DeleteOnTermination": true,
|
||||
"DeviceIndex": 0,
|
||||
"Groups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupnodesadditionaluserdataexamplecom"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"TagSpecifications": [
|
||||
{
|
||||
"ResourceType": "instance",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "additionaluserdata.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "nodes.additionaluserdata.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/node",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "nodes"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/additionaluserdata.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ResourceType": "volume",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "additionaluserdata.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "nodes.additionaluserdata.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/node",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "nodes"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/additionaluserdata.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"UserData": "extracted"
|
||||
}
|
||||
}
|
||||
},
|
||||
"AWSEC2Route00000": {
|
||||
"Type": "AWS::EC2::Route",
|
||||
"Properties": {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Resources.AWSAutoScalingLaunchConfigurationmasterustest1amastersadditionaluserdataexamplecom.Properties.UserData: |
|
||||
Resources.AWSEC2LaunchTemplatemasterustest1amastersadditionaluserdataexamplecom.Properties.LaunchTemplateData.UserData: |
|
||||
Content-Type: multipart/mixed; boundary="MIMEBOUNDARY"
|
||||
MIME-Version: 1.0
|
||||
|
||||
|
|
@ -321,7 +321,7 @@ Resources.AWSAutoScalingLaunchConfigurationmasterustest1amastersadditionaluserda
|
|||
echo "master: The time is now $(date -R)!" | tee /root/output.txt
|
||||
|
||||
--MIMEBOUNDARY--
|
||||
Resources.AWSAutoScalingLaunchConfigurationnodesadditionaluserdataexamplecom.Properties.UserData: |
|
||||
Resources.AWSEC2LaunchTemplatenodesadditionaluserdataexamplecom.Properties.LaunchTemplateData.UserData: |
|
||||
Content-Type: multipart/mixed; boundary="MIMEBOUNDARY"
|
||||
MIME-Version: 1.0
|
||||
|
||||
|
|
|
|||
|
|
@ -1,303 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
encryptionConfig: null
|
||||
etcdClusters:
|
||||
events:
|
||||
version: 3.3.10
|
||||
main:
|
||||
version: 3.3.10
|
||||
kubeAPIServer:
|
||||
allowPrivileged: true
|
||||
anonymousAuth: false
|
||||
apiServerCount: 1
|
||||
authorizationMode: AlwaysAllow
|
||||
bindAddress: 0.0.0.0
|
||||
cloudProvider: aws
|
||||
enableAdmissionPlugins:
|
||||
- NamespaceLifecycle
|
||||
- LimitRanger
|
||||
- ServiceAccount
|
||||
- PersistentVolumeLabel
|
||||
- DefaultStorageClass
|
||||
- DefaultTolerationSeconds
|
||||
- MutatingAdmissionWebhook
|
||||
- ValidatingAdmissionWebhook
|
||||
- NodeRestriction
|
||||
- ResourceQuota
|
||||
etcdServers:
|
||||
- http://127.0.0.1:4001
|
||||
etcdServersOverrides:
|
||||
- /events#http://127.0.0.1:4002
|
||||
image: k8s.gcr.io/kube-apiserver:v1.14.0
|
||||
insecureBindAddress: 127.0.0.1
|
||||
insecurePort: 8080
|
||||
kubeletPreferredAddressTypes:
|
||||
- InternalIP
|
||||
- Hostname
|
||||
- ExternalIP
|
||||
logLevel: 2
|
||||
requestheaderAllowedNames:
|
||||
- aggregator
|
||||
requestheaderExtraHeaderPrefixes:
|
||||
- X-Remote-Extra-
|
||||
requestheaderGroupHeaders:
|
||||
- X-Remote-Group
|
||||
requestheaderUsernameHeaders:
|
||||
- X-Remote-User
|
||||
securePort: 443
|
||||
serviceClusterIPRange: 100.64.0.0/13
|
||||
serviceNodePortRange: 28000-32767
|
||||
storageBackend: etcd3
|
||||
kubeControllerManager:
|
||||
allocateNodeCIDRs: true
|
||||
attachDetachReconcileSyncPeriod: 1m0s
|
||||
cloudProvider: aws
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
clusterName: crosszone.example.com
|
||||
configureCloudRoutes: true
|
||||
image: k8s.gcr.io/kube-controller-manager:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
useServiceAccountCredentials: true
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubeScheduler:
|
||||
image: k8s.gcr.io/kube-scheduler:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
masterKubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
registerSchedulable: false
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: crosszone.example.com
|
||||
ConfigBase: memfs://clusters.example.com/crosszone.example.com
|
||||
InstanceGroupName: master-us-test-1a
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/crosszone.example.com/addons/bootstrap-channel.yaml
|
||||
etcdManifests:
|
||||
- memfs://clusters.example.com/crosszone.example.com/manifests/etcd/main.yaml
|
||||
- memfs://clusters.example.com/crosszone.example.com/manifests/etcd/events.yaml
|
||||
protokubeImage:
|
||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
||||
name: protokube:1.15.0
|
||||
sources:
|
||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
||||
- https://github.com/kubernetes/kops/releases/download/v1.15.0/images-protokube.tar.gz
|
||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -86,12 +86,15 @@ resource "aws_autoscaling_attachment" "master-us-test-1a-masters-crosszone-examp
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "master-us-test-1a-masters-crosszone-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.master-us-test-1a-masters-crosszone-example-com.id
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1a.masters.crosszone.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.master-us-test-1a-masters-crosszone-example-com.id
|
||||
version = aws_launch_template.master-us-test-1a-masters-crosszone-example-com.latest_version
|
||||
}
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1a.masters.crosszone.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -131,13 +134,16 @@ resource "aws_autoscaling_group" "master-us-test-1a-masters-crosszone-example-co
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "nodes-crosszone-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.nodes-crosszone-example-com.id
|
||||
max_size = 2
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 2
|
||||
name = "nodes.crosszone.example.com"
|
||||
suspended_processes = ["AZRebalance"]
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.nodes-crosszone-example-com.id
|
||||
version = aws_launch_template.nodes-crosszone-example-com.latest_version
|
||||
}
|
||||
max_size = 2
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 2
|
||||
name = "nodes.crosszone.example.com"
|
||||
suspended_processes = ["AZRebalance"]
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -285,48 +291,110 @@ resource "aws_key_pair" "kubernetes-crosszone-example-com-c4a6ed9aa889b9e2c39cd6
|
|||
public_key = file("${path.module}/data/aws_key_pair_kubernetes.crosszone.example.com-c4a6ed9aa889b9e2c39cd663eb9c7157_public_key")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "master-us-test-1a-masters-crosszone-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
ephemeral_block_device {
|
||||
resource "aws_launch_template" "master-us-test-1a-masters-crosszone-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
block_device_mappings {
|
||||
device_name = "/dev/sdc"
|
||||
virtual_name = "ephemeral0"
|
||||
}
|
||||
iam_instance_profile = aws_iam_instance_profile.masters-crosszone-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-crosszone-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.masters-crosszone-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-crosszone-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "master-us-test-1a.masters.crosszone.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.masters-crosszone-example-com.id]
|
||||
}
|
||||
security_groups = [aws_security_group.masters-crosszone-example-com.id]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_master-us-test-1a.masters.crosszone.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "crosszone.example.com"
|
||||
"Name" = "master-us-test-1a.masters.crosszone.example.com"
|
||||
"Owner" = "John Doe"
|
||||
"foo/bar" = "fib+baz"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/crosszone.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "crosszone.example.com"
|
||||
"Name" = "master-us-test-1a.masters.crosszone.example.com"
|
||||
"Owner" = "John Doe"
|
||||
"foo/bar" = "fib+baz"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/crosszone.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_master-us-test-1a.masters.crosszone.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "nodes-crosszone-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = true
|
||||
iam_instance_profile = aws_iam_instance_profile.nodes-crosszone-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t2.medium"
|
||||
key_name = aws_key_pair.kubernetes-crosszone-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
resource "aws_launch_template" "nodes-crosszone-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 128
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.nodes-crosszone-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t2.medium"
|
||||
key_name = aws_key_pair.kubernetes-crosszone-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "nodes.crosszone.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 128
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.nodes-crosszone-example-com.id, "sg-exampleid3", "sg-exampleid4"]
|
||||
}
|
||||
security_groups = [aws_security_group.nodes-crosszone-example-com.id, "sg-exampleid3", "sg-exampleid4"]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_nodes.crosszone.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "crosszone.example.com"
|
||||
"Name" = "nodes.crosszone.example.com"
|
||||
"Owner" = "John Doe"
|
||||
"foo/bar" = "fib+baz"
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/crosszone.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "crosszone.example.com"
|
||||
"Name" = "nodes.crosszone.example.com"
|
||||
"Owner" = "John Doe"
|
||||
"foo/bar" = "fib+baz"
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/crosszone.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_nodes.crosszone.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_route53_record" "api-crosszone-example-com" {
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
Content-Type: multipart/mixed; boundary="MIMEBOUNDARY"
|
||||
MIME-Version: 1.0
|
||||
|
||||
--MIMEBOUNDARY
|
||||
Content-Disposition: attachment; filename="myscript.sh"
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Content-Type: text/x-shellscript
|
||||
Mime-Version: 1.0
|
||||
|
||||
#!/bin/sh
|
||||
echo "Hello World, from the bastion! The time is now $(date -R)!" | tee /root/output.txt
|
||||
|
||||
--MIMEBOUNDARY--
|
||||
|
|
@ -1,300 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
encryptionConfig: null
|
||||
etcdClusters:
|
||||
events:
|
||||
version: 3.3.10
|
||||
main:
|
||||
version: 3.3.10
|
||||
kubeAPIServer:
|
||||
allowPrivileged: true
|
||||
anonymousAuth: false
|
||||
apiServerCount: 1
|
||||
authorizationMode: AlwaysAllow
|
||||
bindAddress: 0.0.0.0
|
||||
cloudProvider: aws
|
||||
enableAdmissionPlugins:
|
||||
- NamespaceLifecycle
|
||||
- LimitRanger
|
||||
- ServiceAccount
|
||||
- PersistentVolumeLabel
|
||||
- DefaultStorageClass
|
||||
- DefaultTolerationSeconds
|
||||
- MutatingAdmissionWebhook
|
||||
- ValidatingAdmissionWebhook
|
||||
- NodeRestriction
|
||||
- ResourceQuota
|
||||
etcdServers:
|
||||
- http://127.0.0.1:4001
|
||||
etcdServersOverrides:
|
||||
- /events#http://127.0.0.1:4002
|
||||
image: k8s.gcr.io/kube-apiserver:v1.14.0
|
||||
insecureBindAddress: 127.0.0.1
|
||||
insecurePort: 8080
|
||||
kubeletPreferredAddressTypes:
|
||||
- InternalIP
|
||||
- Hostname
|
||||
- ExternalIP
|
||||
logLevel: 2
|
||||
requestheaderAllowedNames:
|
||||
- aggregator
|
||||
requestheaderExtraHeaderPrefixes:
|
||||
- X-Remote-Extra-
|
||||
requestheaderGroupHeaders:
|
||||
- X-Remote-Group
|
||||
requestheaderUsernameHeaders:
|
||||
- X-Remote-User
|
||||
securePort: 443
|
||||
serviceClusterIPRange: 100.64.0.0/13
|
||||
storageBackend: etcd3
|
||||
kubeControllerManager:
|
||||
allocateNodeCIDRs: true
|
||||
attachDetachReconcileSyncPeriod: 1m0s
|
||||
cloudProvider: aws
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
clusterName: bastionuserdata.example.com
|
||||
configureCloudRoutes: false
|
||||
image: k8s.gcr.io/kube-controller-manager:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
useServiceAccountCredentials: true
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubeScheduler:
|
||||
image: k8s.gcr.io/kube-scheduler:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginName: cni
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
masterKubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginName: cni
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
registerSchedulable: false
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: bastionuserdata.example.com
|
||||
ConfigBase: memfs://clusters.example.com/bastionuserdata.example.com
|
||||
InstanceGroupName: master-us-test-1a
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/bastionuserdata.example.com/addons/bootstrap-channel.yaml
|
||||
etcdManifests:
|
||||
- memfs://clusters.example.com/bastionuserdata.example.com/manifests/etcd/main.yaml
|
||||
- memfs://clusters.example.com/bastionuserdata.example.com/manifests/etcd/events.yaml
|
||||
protokubeImage:
|
||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
||||
name: protokube:1.15.0
|
||||
sources:
|
||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
||||
- https://github.com/kubernetes/kops/releases/download/v1.15.0/images-protokube.tar.gz
|
||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
|
|
@ -1,228 +0,0 @@
|
|||
Content-Type: multipart/mixed; boundary="MIMEBOUNDARY"
|
||||
MIME-Version: 1.0
|
||||
|
||||
--MIMEBOUNDARY
|
||||
Content-Disposition: attachment; filename="nodeup.sh"
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Content-Type: text/x-shellscript
|
||||
Mime-Version: 1.0
|
||||
|
||||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginName: cni
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: bastionuserdata.example.com
|
||||
ConfigBase: memfs://clusters.example.com/bastionuserdata.example.com
|
||||
InstanceGroupName: nodes
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/bastionuserdata.example.com/addons/bootstrap-channel.yaml
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
|
||||
--MIMEBOUNDARY
|
||||
Content-Disposition: attachment; filename="myscript.sh"
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Content-Type: text/x-shellscript
|
||||
Mime-Version: 1.0
|
||||
|
||||
#!/bin/sh
|
||||
echo "Hello World, from a node! The time is now $(date -R)!" | tee /root/output.txt
|
||||
|
||||
--MIMEBOUNDARY--
|
||||
|
|
@ -0,0 +1 @@
|
|||
Q29udGVudC1UeXBlOiBtdWx0aXBhcnQvbWl4ZWQ7IGJvdW5kYXJ5PSJNSU1FQk9VTkRBUlkiDQpNSU1FLVZlcnNpb246IDEuMA0KDQotLU1JTUVCT1VOREFSWQ0KQ29udGVudC1EaXNwb3NpdGlvbjogYXR0YWNobWVudDsgZmlsZW5hbWU9Im15c2NyaXB0LnNoIg0KQ29udGVudC1UcmFuc2Zlci1FbmNvZGluZzogN2JpdA0KQ29udGVudC1UeXBlOiB0ZXh0L3gtc2hlbGxzY3JpcHQNCk1pbWUtVmVyc2lvbjogMS4wDQoNCiMhL2Jpbi9zaAplY2hvICJIZWxsbyBXb3JsZCwgZnJvbSB0aGUgYmFzdGlvbiEgIFRoZSB0aW1lIGlzIG5vdyAkKGRhdGUgLVIpISIgfCB0ZWUgL3Jvb3Qvb3V0cHV0LnR4dAoNCi0tTUlNRUJPVU5EQVJZLS0NCg==
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -121,12 +121,15 @@ resource "aws_autoscaling_attachment" "master-us-test-1a-masters-bastionuserdata
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "bastion-bastionuserdata-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.bastion-bastionuserdata-example-com.id
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "bastion.bastionuserdata.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.bastion-bastionuserdata-example-com.id
|
||||
version = aws_launch_template.bastion-bastionuserdata-example-com.latest_version
|
||||
}
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "bastion.bastionuserdata.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -156,12 +159,15 @@ resource "aws_autoscaling_group" "bastion-bastionuserdata-example-com" {
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "master-us-test-1a-masters-bastionuserdata-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.master-us-test-1a-masters-bastionuserdata-example-com.id
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1a.masters.bastionuserdata.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.master-us-test-1a-masters-bastionuserdata-example-com.id
|
||||
version = aws_launch_template.master-us-test-1a-masters-bastionuserdata-example-com.latest_version
|
||||
}
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1a.masters.bastionuserdata.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -191,12 +197,15 @@ resource "aws_autoscaling_group" "master-us-test-1a-masters-bastionuserdata-exam
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "nodes-bastionuserdata-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.nodes-bastionuserdata-example-com.id
|
||||
max_size = 2
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 2
|
||||
name = "nodes.bastionuserdata.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.nodes-bastionuserdata-example-com.id
|
||||
version = aws_launch_template.nodes-bastionuserdata-example-com.latest_version
|
||||
}
|
||||
max_size = 2
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 2
|
||||
name = "nodes.bastionuserdata.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -377,68 +386,149 @@ resource "aws_key_pair" "kubernetes-bastionuserdata-example-com-c4a6ed9aa889b9e2
|
|||
public_key = file("${path.module}/data/aws_key_pair_kubernetes.bastionuserdata.example.com-c4a6ed9aa889b9e2c39cd663eb9c7157_public_key")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "bastion-bastionuserdata-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
iam_instance_profile = aws_iam_instance_profile.bastions-bastionuserdata-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t2.micro"
|
||||
key_name = aws_key_pair.kubernetes-bastionuserdata-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
resource "aws_launch_template" "bastion-bastionuserdata-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 32
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.bastions-bastionuserdata-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t2.micro"
|
||||
key_name = aws_key_pair.kubernetes-bastionuserdata-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "bastion.bastionuserdata.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 32
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.bastion-bastionuserdata-example-com.id]
|
||||
}
|
||||
security_groups = [aws_security_group.bastion-bastionuserdata-example-com.id]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_bastion.bastionuserdata.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "bastionuserdata.example.com"
|
||||
"Name" = "bastion.bastionuserdata.example.com"
|
||||
"k8s.io/role/bastion" = "1"
|
||||
"kops.k8s.io/instancegroup" = "bastion"
|
||||
"kubernetes.io/cluster/bastionuserdata.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "bastionuserdata.example.com"
|
||||
"Name" = "bastion.bastionuserdata.example.com"
|
||||
"k8s.io/role/bastion" = "1"
|
||||
"kops.k8s.io/instancegroup" = "bastion"
|
||||
"kubernetes.io/cluster/bastionuserdata.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_bastion.bastionuserdata.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "master-us-test-1a-masters-bastionuserdata-example-com" {
|
||||
associate_public_ip_address = false
|
||||
enable_monitoring = false
|
||||
ephemeral_block_device {
|
||||
resource "aws_launch_template" "master-us-test-1a-masters-bastionuserdata-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
block_device_mappings {
|
||||
device_name = "/dev/sdc"
|
||||
virtual_name = "ephemeral0"
|
||||
}
|
||||
iam_instance_profile = aws_iam_instance_profile.masters-bastionuserdata-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-bastionuserdata-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.masters-bastionuserdata-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-bastionuserdata-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "master-us-test-1a.masters.bastionuserdata.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = false
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.masters-bastionuserdata-example-com.id]
|
||||
}
|
||||
security_groups = [aws_security_group.masters-bastionuserdata-example-com.id]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_master-us-test-1a.masters.bastionuserdata.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "bastionuserdata.example.com"
|
||||
"Name" = "master-us-test-1a.masters.bastionuserdata.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/bastionuserdata.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "bastionuserdata.example.com"
|
||||
"Name" = "master-us-test-1a.masters.bastionuserdata.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/bastionuserdata.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_master-us-test-1a.masters.bastionuserdata.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "nodes-bastionuserdata-example-com" {
|
||||
associate_public_ip_address = false
|
||||
enable_monitoring = false
|
||||
iam_instance_profile = aws_iam_instance_profile.nodes-bastionuserdata-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t2.medium"
|
||||
key_name = aws_key_pair.kubernetes-bastionuserdata-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
resource "aws_launch_template" "nodes-bastionuserdata-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 128
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.nodes-bastionuserdata-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t2.medium"
|
||||
key_name = aws_key_pair.kubernetes-bastionuserdata-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "nodes.bastionuserdata.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 128
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = false
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.nodes-bastionuserdata-example-com.id]
|
||||
}
|
||||
security_groups = [aws_security_group.nodes-bastionuserdata-example-com.id]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_nodes.bastionuserdata.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "bastionuserdata.example.com"
|
||||
"Name" = "nodes.bastionuserdata.example.com"
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/bastionuserdata.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "bastionuserdata.example.com"
|
||||
"Name" = "nodes.bastionuserdata.example.com"
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/bastionuserdata.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_nodes.bastionuserdata.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_nat_gateway" "us-test-1a-bastionuserdata-example-com" {
|
||||
|
|
|
|||
|
|
@ -4,8 +4,16 @@
|
|||
"Type": "AWS::AutoScaling::AutoScalingGroup",
|
||||
"Properties": {
|
||||
"AutoScalingGroupName": "master-us-test-1a.masters.complex.example.com",
|
||||
"LaunchConfigurationName": {
|
||||
"Ref": "AWSAutoScalingLaunchConfigurationmasterustest1amasterscomplexexamplecom"
|
||||
"LaunchTemplate": {
|
||||
"LaunchTemplateId": {
|
||||
"Ref": "AWSEC2LaunchTemplatemasterustest1amasterscomplexexamplecom"
|
||||
},
|
||||
"Version": {
|
||||
"Fn::GetAtt": [
|
||||
"AWSEC2LaunchTemplatemasterustest1amasterscomplexexamplecom",
|
||||
"LatestVersionNumber"
|
||||
]
|
||||
}
|
||||
},
|
||||
"MaxSize": 1,
|
||||
"MinSize": 1,
|
||||
|
|
@ -77,8 +85,16 @@
|
|||
"Type": "AWS::AutoScaling::AutoScalingGroup",
|
||||
"Properties": {
|
||||
"AutoScalingGroupName": "nodes.complex.example.com",
|
||||
"LaunchConfigurationName": {
|
||||
"Ref": "AWSAutoScalingLaunchConfigurationnodescomplexexamplecom"
|
||||
"LaunchTemplate": {
|
||||
"LaunchTemplateId": {
|
||||
"Ref": "AWSEC2LaunchTemplatenodescomplexexamplecom"
|
||||
},
|
||||
"Version": {
|
||||
"Fn::GetAtt": [
|
||||
"AWSEC2LaunchTemplatenodescomplexexamplecom",
|
||||
"LatestVersionNumber"
|
||||
]
|
||||
}
|
||||
},
|
||||
"MaxSize": 2,
|
||||
"MinSize": 2,
|
||||
|
|
@ -141,78 +157,6 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"AWSAutoScalingLaunchConfigurationmasterustest1amasterscomplexexamplecom": {
|
||||
"Type": "AWS::AutoScaling::LaunchConfiguration",
|
||||
"Properties": {
|
||||
"AssociatePublicIpAddress": true,
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 64,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeviceName": "/dev/sdc",
|
||||
"VirtualName": "ephemeral0"
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Ref": "AWSIAMInstanceProfilemasterscomplexexamplecom"
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "m3.medium",
|
||||
"KeyName": "kubernetes.complex.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"SecurityGroups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupmasterscomplexexamplecom"
|
||||
}
|
||||
],
|
||||
"UserData": "extracted",
|
||||
"InstanceMonitoring": false
|
||||
}
|
||||
},
|
||||
"AWSAutoScalingLaunchConfigurationnodescomplexexamplecom": {
|
||||
"Type": "AWS::AutoScaling::LaunchConfiguration",
|
||||
"Properties": {
|
||||
"AssociatePublicIpAddress": true,
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 128,
|
||||
"DeleteOnTermination": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeviceName": "/dev/xvdd",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 20,
|
||||
"DeleteOnTermination": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Ref": "AWSIAMInstanceProfilenodescomplexexamplecom"
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "t2.medium",
|
||||
"KeyName": "kubernetes.complex.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"SecurityGroups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupnodescomplexexamplecom"
|
||||
},
|
||||
"sg-exampleid3",
|
||||
"sg-exampleid4"
|
||||
],
|
||||
"UserData": "extracted",
|
||||
"InstanceMonitoring": true
|
||||
}
|
||||
},
|
||||
"AWSEC2DHCPOptionscomplexexamplecom": {
|
||||
"Type": "AWS::EC2::DHCPOptions",
|
||||
"Properties": {
|
||||
|
|
@ -271,6 +215,234 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"AWSEC2LaunchTemplatemasterustest1amasterscomplexexamplecom": {
|
||||
"Type": "AWS::EC2::LaunchTemplate",
|
||||
"Properties": {
|
||||
"LaunchTemplateName": "master-us-test-1a.masters.complex.example.com",
|
||||
"LaunchTemplateData": {
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 64,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeviceName": "/dev/sdc",
|
||||
"VirtualName": "ephemeral0"
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Name": {
|
||||
"Ref": "AWSIAMInstanceProfilemasterscomplexexamplecom"
|
||||
}
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "m3.medium",
|
||||
"KeyName": "kubernetes.complex.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"NetworkInterfaces": [
|
||||
{
|
||||
"AssociatePublicIpAddress": true,
|
||||
"DeleteOnTermination": true,
|
||||
"DeviceIndex": 0,
|
||||
"Groups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupmasterscomplexexamplecom"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"TagSpecifications": [
|
||||
{
|
||||
"ResourceType": "instance",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "complex.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "master-us-test-1a.masters.complex.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Owner",
|
||||
"Value": "John Doe"
|
||||
},
|
||||
{
|
||||
"Key": "foo/bar",
|
||||
"Value": "fib+baz"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/master",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "master-us-test-1a"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/complex.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ResourceType": "volume",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "complex.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "master-us-test-1a.masters.complex.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Owner",
|
||||
"Value": "John Doe"
|
||||
},
|
||||
{
|
||||
"Key": "foo/bar",
|
||||
"Value": "fib+baz"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/master",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "master-us-test-1a"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/complex.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"UserData": "extracted"
|
||||
}
|
||||
}
|
||||
},
|
||||
"AWSEC2LaunchTemplatenodescomplexexamplecom": {
|
||||
"Type": "AWS::EC2::LaunchTemplate",
|
||||
"Properties": {
|
||||
"LaunchTemplateName": "nodes.complex.example.com",
|
||||
"LaunchTemplateData": {
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 128,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeviceName": "/dev/xvdd",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 20,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Name": {
|
||||
"Ref": "AWSIAMInstanceProfilenodescomplexexamplecom"
|
||||
}
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "t2.medium",
|
||||
"KeyName": "kubernetes.complex.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"NetworkInterfaces": [
|
||||
{
|
||||
"AssociatePublicIpAddress": true,
|
||||
"DeleteOnTermination": true,
|
||||
"DeviceIndex": 0,
|
||||
"Groups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupnodescomplexexamplecom"
|
||||
},
|
||||
"sg-exampleid3",
|
||||
"sg-exampleid4"
|
||||
]
|
||||
}
|
||||
],
|
||||
"TagSpecifications": [
|
||||
{
|
||||
"ResourceType": "instance",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "complex.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "nodes.complex.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Owner",
|
||||
"Value": "John Doe"
|
||||
},
|
||||
{
|
||||
"Key": "foo/bar",
|
||||
"Value": "fib+baz"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/node",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "nodes"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/complex.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ResourceType": "volume",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "complex.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "nodes.complex.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Owner",
|
||||
"Value": "John Doe"
|
||||
},
|
||||
{
|
||||
"Key": "foo/bar",
|
||||
"Value": "fib+baz"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/node",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "nodes"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/complex.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"UserData": "extracted"
|
||||
}
|
||||
}
|
||||
},
|
||||
"AWSEC2Route00000": {
|
||||
"Type": "AWS::EC2::Route",
|
||||
"Properties": {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Resources.AWSAutoScalingLaunchConfigurationmasterustest1amasterscomplexexamplecom.Properties.UserData: |
|
||||
Resources.AWSEC2LaunchTemplatemasterustest1amasterscomplexexamplecom.Properties.LaunchTemplateData.UserData: |
|
||||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
|
|
@ -303,7 +303,7 @@ Resources.AWSAutoScalingLaunchConfigurationmasterustest1amasterscomplexexampleco
|
|||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
Resources.AWSAutoScalingLaunchConfigurationnodescomplexexamplecom.Properties.UserData: |
|
||||
Resources.AWSEC2LaunchTemplatenodescomplexexamplecom.Properties.LaunchTemplateData.UserData: |
|
||||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -1,304 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
encryptionConfig: null
|
||||
etcdClusters:
|
||||
events:
|
||||
version: 3.3.10
|
||||
main:
|
||||
version: 3.3.10
|
||||
kubeAPIServer:
|
||||
allowPrivileged: true
|
||||
anonymousAuth: false
|
||||
apiServerCount: 1
|
||||
auditWebhookBatchThrottleQps: 3140m
|
||||
authorizationMode: AlwaysAllow
|
||||
bindAddress: 0.0.0.0
|
||||
cloudProvider: aws
|
||||
enableAdmissionPlugins:
|
||||
- NamespaceLifecycle
|
||||
- LimitRanger
|
||||
- ServiceAccount
|
||||
- PersistentVolumeLabel
|
||||
- DefaultStorageClass
|
||||
- DefaultTolerationSeconds
|
||||
- MutatingAdmissionWebhook
|
||||
- ValidatingAdmissionWebhook
|
||||
- NodeRestriction
|
||||
- ResourceQuota
|
||||
etcdServers:
|
||||
- http://127.0.0.1:4001
|
||||
etcdServersOverrides:
|
||||
- /events#http://127.0.0.1:4002
|
||||
image: k8s.gcr.io/kube-apiserver:v1.14.0
|
||||
insecureBindAddress: 127.0.0.1
|
||||
insecurePort: 8080
|
||||
kubeletPreferredAddressTypes:
|
||||
- InternalIP
|
||||
- Hostname
|
||||
- ExternalIP
|
||||
logLevel: 2
|
||||
requestheaderAllowedNames:
|
||||
- aggregator
|
||||
requestheaderExtraHeaderPrefixes:
|
||||
- X-Remote-Extra-
|
||||
requestheaderGroupHeaders:
|
||||
- X-Remote-Group
|
||||
requestheaderUsernameHeaders:
|
||||
- X-Remote-User
|
||||
securePort: 443
|
||||
serviceClusterIPRange: 100.64.0.0/13
|
||||
serviceNodePortRange: 28000-32767
|
||||
storageBackend: etcd3
|
||||
kubeControllerManager:
|
||||
allocateNodeCIDRs: true
|
||||
attachDetachReconcileSyncPeriod: 1m0s
|
||||
cloudProvider: aws
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
clusterName: complex.example.com
|
||||
configureCloudRoutes: true
|
||||
image: k8s.gcr.io/kube-controller-manager:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
useServiceAccountCredentials: true
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubeScheduler:
|
||||
image: k8s.gcr.io/kube-scheduler:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
masterKubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
registerSchedulable: false
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: complex.example.com
|
||||
ConfigBase: memfs://clusters.example.com/complex.example.com
|
||||
InstanceGroupName: master-us-test-1a
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/complex.example.com/addons/bootstrap-channel.yaml
|
||||
etcdManifests:
|
||||
- memfs://clusters.example.com/complex.example.com/manifests/etcd/main.yaml
|
||||
- memfs://clusters.example.com/complex.example.com/manifests/etcd/events.yaml
|
||||
protokubeImage:
|
||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
||||
name: protokube:1.15.0
|
||||
sources:
|
||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
||||
- https://github.com/kubernetes/kops/releases/download/v1.15.0/images-protokube.tar.gz
|
||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
|
|
@ -1,209 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: complex.example.com
|
||||
ConfigBase: memfs://clusters.example.com/complex.example.com
|
||||
InstanceGroupName: nodes
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/complex.example.com/addons/bootstrap-channel.yaml
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -86,12 +86,15 @@ resource "aws_autoscaling_attachment" "master-us-test-1a-masters-complex-example
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "master-us-test-1a-masters-complex-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.master-us-test-1a-masters-complex-example-com.id
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1a.masters.complex.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.master-us-test-1a-masters-complex-example-com.id
|
||||
version = aws_launch_template.master-us-test-1a-masters-complex-example-com.latest_version
|
||||
}
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1a.masters.complex.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -131,13 +134,16 @@ resource "aws_autoscaling_group" "master-us-test-1a-masters-complex-example-com"
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "nodes-complex-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.nodes-complex-example-com.id
|
||||
max_size = 2
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 2
|
||||
name = "nodes.complex.example.com"
|
||||
suspended_processes = ["AZRebalance"]
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.nodes-complex-example-com.id
|
||||
version = aws_launch_template.nodes-complex-example-com.latest_version
|
||||
}
|
||||
max_size = 2
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 2
|
||||
name = "nodes.complex.example.com"
|
||||
suspended_processes = ["AZRebalance"]
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -285,54 +291,118 @@ resource "aws_key_pair" "kubernetes-complex-example-com-c4a6ed9aa889b9e2c39cd663
|
|||
public_key = file("${path.module}/data/aws_key_pair_kubernetes.complex.example.com-c4a6ed9aa889b9e2c39cd663eb9c7157_public_key")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "master-us-test-1a-masters-complex-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
ephemeral_block_device {
|
||||
resource "aws_launch_template" "master-us-test-1a-masters-complex-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
block_device_mappings {
|
||||
device_name = "/dev/sdc"
|
||||
virtual_name = "ephemeral0"
|
||||
}
|
||||
iam_instance_profile = aws_iam_instance_profile.masters-complex-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-complex-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.masters-complex-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-complex-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "master-us-test-1a.masters.complex.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.masters-complex-example-com.id]
|
||||
}
|
||||
security_groups = [aws_security_group.masters-complex-example-com.id]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_master-us-test-1a.masters.complex.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "complex.example.com"
|
||||
"Name" = "master-us-test-1a.masters.complex.example.com"
|
||||
"Owner" = "John Doe"
|
||||
"foo/bar" = "fib+baz"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/complex.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "complex.example.com"
|
||||
"Name" = "master-us-test-1a.masters.complex.example.com"
|
||||
"Owner" = "John Doe"
|
||||
"foo/bar" = "fib+baz"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/complex.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_master-us-test-1a.masters.complex.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "nodes-complex-example-com" {
|
||||
associate_public_ip_address = true
|
||||
ebs_block_device {
|
||||
delete_on_termination = false
|
||||
device_name = "/dev/xvdd"
|
||||
volume_size = 20
|
||||
volume_type = "gp2"
|
||||
resource "aws_launch_template" "nodes-complex-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 128
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
enable_monitoring = true
|
||||
iam_instance_profile = aws_iam_instance_profile.nodes-complex-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t2.medium"
|
||||
key_name = aws_key_pair.kubernetes-complex-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvdd"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 20
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.nodes-complex-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t2.medium"
|
||||
key_name = aws_key_pair.kubernetes-complex-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "nodes.complex.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = false
|
||||
volume_size = 128
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.nodes-complex-example-com.id, "sg-exampleid3", "sg-exampleid4"]
|
||||
}
|
||||
security_groups = [aws_security_group.nodes-complex-example-com.id, "sg-exampleid3", "sg-exampleid4"]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_nodes.complex.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "complex.example.com"
|
||||
"Name" = "nodes.complex.example.com"
|
||||
"Owner" = "John Doe"
|
||||
"foo/bar" = "fib+baz"
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/complex.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "complex.example.com"
|
||||
"Name" = "nodes.complex.example.com"
|
||||
"Owner" = "John Doe"
|
||||
"foo/bar" = "fib+baz"
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/complex.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_nodes.complex.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_route53_record" "api-complex-example-com" {
|
||||
|
|
|
|||
|
|
@ -4,8 +4,16 @@
|
|||
"Type": "AWS::AutoScaling::AutoScalingGroup",
|
||||
"Properties": {
|
||||
"AutoScalingGroupName": "master-us-test-1a.masters.containerd.example.com",
|
||||
"LaunchConfigurationName": {
|
||||
"Ref": "AWSAutoScalingLaunchConfigurationmasterustest1amasterscontainerdexamplecom"
|
||||
"LaunchTemplate": {
|
||||
"LaunchTemplateId": {
|
||||
"Ref": "AWSEC2LaunchTemplatemasterustest1amasterscontainerdexamplecom"
|
||||
},
|
||||
"Version": {
|
||||
"Fn::GetAtt": [
|
||||
"AWSEC2LaunchTemplatemasterustest1amasterscontainerdexamplecom",
|
||||
"LatestVersionNumber"
|
||||
]
|
||||
}
|
||||
},
|
||||
"MaxSize": 1,
|
||||
"MinSize": 1,
|
||||
|
|
@ -62,8 +70,16 @@
|
|||
"Type": "AWS::AutoScaling::AutoScalingGroup",
|
||||
"Properties": {
|
||||
"AutoScalingGroupName": "nodes.containerd.example.com",
|
||||
"LaunchConfigurationName": {
|
||||
"Ref": "AWSAutoScalingLaunchConfigurationnodescontainerdexamplecom"
|
||||
"LaunchTemplate": {
|
||||
"LaunchTemplateId": {
|
||||
"Ref": "AWSEC2LaunchTemplatenodescontainerdexamplecom"
|
||||
},
|
||||
"Version": {
|
||||
"Fn::GetAtt": [
|
||||
"AWSEC2LaunchTemplatenodescontainerdexamplecom",
|
||||
"LatestVersionNumber"
|
||||
]
|
||||
}
|
||||
},
|
||||
"MaxSize": 2,
|
||||
"MinSize": 2,
|
||||
|
|
@ -116,68 +132,6 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"AWSAutoScalingLaunchConfigurationmasterustest1amasterscontainerdexamplecom": {
|
||||
"Type": "AWS::AutoScaling::LaunchConfiguration",
|
||||
"Properties": {
|
||||
"AssociatePublicIpAddress": true,
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 64,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeviceName": "/dev/sdc",
|
||||
"VirtualName": "ephemeral0"
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Ref": "AWSIAMInstanceProfilemasterscontainerdexamplecom"
|
||||
},
|
||||
"ImageId": "ami-11400000",
|
||||
"InstanceType": "m3.medium",
|
||||
"KeyName": "kubernetes.containerd.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"SecurityGroups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupmasterscontainerdexamplecom"
|
||||
}
|
||||
],
|
||||
"UserData": "extracted",
|
||||
"InstanceMonitoring": false
|
||||
}
|
||||
},
|
||||
"AWSAutoScalingLaunchConfigurationnodescontainerdexamplecom": {
|
||||
"Type": "AWS::AutoScaling::LaunchConfiguration",
|
||||
"Properties": {
|
||||
"AssociatePublicIpAddress": true,
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 128,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Ref": "AWSIAMInstanceProfilenodescontainerdexamplecom"
|
||||
},
|
||||
"ImageId": "ami-11400000",
|
||||
"InstanceType": "t2.medium",
|
||||
"KeyName": "kubernetes.containerd.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"SecurityGroups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupnodescontainerdexamplecom"
|
||||
}
|
||||
],
|
||||
"UserData": "extracted",
|
||||
"InstanceMonitoring": false
|
||||
}
|
||||
},
|
||||
"AWSEC2DHCPOptionscontainerdexamplecom": {
|
||||
"Type": "AWS::EC2::DHCPOptions",
|
||||
"Properties": {
|
||||
|
|
@ -220,6 +174,192 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"AWSEC2LaunchTemplatemasterustest1amasterscontainerdexamplecom": {
|
||||
"Type": "AWS::EC2::LaunchTemplate",
|
||||
"Properties": {
|
||||
"LaunchTemplateName": "master-us-test-1a.masters.containerd.example.com",
|
||||
"LaunchTemplateData": {
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 64,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeviceName": "/dev/sdc",
|
||||
"VirtualName": "ephemeral0"
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Name": {
|
||||
"Ref": "AWSIAMInstanceProfilemasterscontainerdexamplecom"
|
||||
}
|
||||
},
|
||||
"ImageId": "ami-11400000",
|
||||
"InstanceType": "m3.medium",
|
||||
"KeyName": "kubernetes.containerd.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"NetworkInterfaces": [
|
||||
{
|
||||
"AssociatePublicIpAddress": true,
|
||||
"DeleteOnTermination": true,
|
||||
"DeviceIndex": 0,
|
||||
"Groups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupmasterscontainerdexamplecom"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"TagSpecifications": [
|
||||
{
|
||||
"ResourceType": "instance",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "containerd.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "master-us-test-1a.masters.containerd.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/master",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "master-us-test-1a"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/containerd.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ResourceType": "volume",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "containerd.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "master-us-test-1a.masters.containerd.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/master",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "master-us-test-1a"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/containerd.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"UserData": "extracted"
|
||||
}
|
||||
}
|
||||
},
|
||||
"AWSEC2LaunchTemplatenodescontainerdexamplecom": {
|
||||
"Type": "AWS::EC2::LaunchTemplate",
|
||||
"Properties": {
|
||||
"LaunchTemplateName": "nodes.containerd.example.com",
|
||||
"LaunchTemplateData": {
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 128,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Name": {
|
||||
"Ref": "AWSIAMInstanceProfilenodescontainerdexamplecom"
|
||||
}
|
||||
},
|
||||
"ImageId": "ami-11400000",
|
||||
"InstanceType": "t2.medium",
|
||||
"KeyName": "kubernetes.containerd.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"NetworkInterfaces": [
|
||||
{
|
||||
"AssociatePublicIpAddress": true,
|
||||
"DeleteOnTermination": true,
|
||||
"DeviceIndex": 0,
|
||||
"Groups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupnodescontainerdexamplecom"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"TagSpecifications": [
|
||||
{
|
||||
"ResourceType": "instance",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "containerd.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "nodes.containerd.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/node",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "nodes"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/containerd.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ResourceType": "volume",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "containerd.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "nodes.containerd.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/node",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "nodes"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/containerd.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"UserData": "extracted"
|
||||
}
|
||||
}
|
||||
},
|
||||
"AWSEC2Route00000": {
|
||||
"Type": "AWS::EC2::Route",
|
||||
"Properties": {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Resources.AWSAutoScalingLaunchConfigurationmasterustest1amasterscontainerdexamplecom.Properties.UserData: |
|
||||
Resources.AWSEC2LaunchTemplatemasterustest1amasterscontainerdexamplecom.Properties.LaunchTemplateData.UserData: |
|
||||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
|
|
@ -300,7 +300,7 @@ Resources.AWSAutoScalingLaunchConfigurationmasterustest1amasterscontainerdexampl
|
|||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
Resources.AWSAutoScalingLaunchConfigurationnodescontainerdexamplecom.Properties.UserData: |
|
||||
Resources.AWSEC2LaunchTemplatenodescontainerdexamplecom.Properties.LaunchTemplateData.UserData: |
|
||||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -1,302 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
encryptionConfig: null
|
||||
etcdClusters:
|
||||
events:
|
||||
version: 3.3.10
|
||||
main:
|
||||
version: 3.3.10
|
||||
kubeAPIServer:
|
||||
allowPrivileged: true
|
||||
anonymousAuth: false
|
||||
apiServerCount: 3
|
||||
authorizationMode: AlwaysAllow
|
||||
bindAddress: 0.0.0.0
|
||||
cloudProvider: aws
|
||||
enableAdmissionPlugins:
|
||||
- NamespaceLifecycle
|
||||
- LimitRanger
|
||||
- ServiceAccount
|
||||
- PersistentVolumeLabel
|
||||
- DefaultStorageClass
|
||||
- DefaultTolerationSeconds
|
||||
- MutatingAdmissionWebhook
|
||||
- ValidatingAdmissionWebhook
|
||||
- NodeRestriction
|
||||
- ResourceQuota
|
||||
etcdServers:
|
||||
- http://127.0.0.1:4001
|
||||
etcdServersOverrides:
|
||||
- /events#http://127.0.0.1:4002
|
||||
image: k8s.gcr.io/kube-apiserver:v1.14.0
|
||||
insecureBindAddress: 127.0.0.1
|
||||
insecurePort: 8080
|
||||
kubeletPreferredAddressTypes:
|
||||
- InternalIP
|
||||
- Hostname
|
||||
- ExternalIP
|
||||
logLevel: 2
|
||||
requestheaderAllowedNames:
|
||||
- aggregator
|
||||
requestheaderExtraHeaderPrefixes:
|
||||
- X-Remote-Extra-
|
||||
requestheaderGroupHeaders:
|
||||
- X-Remote-Group
|
||||
requestheaderUsernameHeaders:
|
||||
- X-Remote-User
|
||||
securePort: 443
|
||||
serviceClusterIPRange: 100.64.0.0/13
|
||||
storageBackend: etcd3
|
||||
kubeControllerManager:
|
||||
allocateNodeCIDRs: true
|
||||
attachDetachReconcileSyncPeriod: 1m0s
|
||||
cloudProvider: aws
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
clusterName: existing-iam.example.com
|
||||
configureCloudRoutes: true
|
||||
image: k8s.gcr.io/kube-controller-manager:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
useServiceAccountCredentials: true
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubeScheduler:
|
||||
image: k8s.gcr.io/kube-scheduler:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
masterKubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
registerSchedulable: false
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: existing-iam.example.com
|
||||
ConfigBase: memfs://tests/existing-iam.example.com
|
||||
InstanceGroupName: master-us-test-1a
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://tests/existing-iam.example.com/addons/bootstrap-channel.yaml
|
||||
etcdManifests:
|
||||
- memfs://tests/existing-iam.example.com/manifests/etcd/main.yaml
|
||||
- memfs://tests/existing-iam.example.com/manifests/etcd/events.yaml
|
||||
protokubeImage:
|
||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
||||
name: protokube:1.15.0
|
||||
sources:
|
||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
||||
- https://github.com/kubernetes/kops/releases/download/v1.15.0/images-protokube.tar.gz
|
||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
|
|
@ -1,302 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
encryptionConfig: null
|
||||
etcdClusters:
|
||||
events:
|
||||
version: 3.3.10
|
||||
main:
|
||||
version: 3.3.10
|
||||
kubeAPIServer:
|
||||
allowPrivileged: true
|
||||
anonymousAuth: false
|
||||
apiServerCount: 3
|
||||
authorizationMode: AlwaysAllow
|
||||
bindAddress: 0.0.0.0
|
||||
cloudProvider: aws
|
||||
enableAdmissionPlugins:
|
||||
- NamespaceLifecycle
|
||||
- LimitRanger
|
||||
- ServiceAccount
|
||||
- PersistentVolumeLabel
|
||||
- DefaultStorageClass
|
||||
- DefaultTolerationSeconds
|
||||
- MutatingAdmissionWebhook
|
||||
- ValidatingAdmissionWebhook
|
||||
- NodeRestriction
|
||||
- ResourceQuota
|
||||
etcdServers:
|
||||
- http://127.0.0.1:4001
|
||||
etcdServersOverrides:
|
||||
- /events#http://127.0.0.1:4002
|
||||
image: k8s.gcr.io/kube-apiserver:v1.14.0
|
||||
insecureBindAddress: 127.0.0.1
|
||||
insecurePort: 8080
|
||||
kubeletPreferredAddressTypes:
|
||||
- InternalIP
|
||||
- Hostname
|
||||
- ExternalIP
|
||||
logLevel: 2
|
||||
requestheaderAllowedNames:
|
||||
- aggregator
|
||||
requestheaderExtraHeaderPrefixes:
|
||||
- X-Remote-Extra-
|
||||
requestheaderGroupHeaders:
|
||||
- X-Remote-Group
|
||||
requestheaderUsernameHeaders:
|
||||
- X-Remote-User
|
||||
securePort: 443
|
||||
serviceClusterIPRange: 100.64.0.0/13
|
||||
storageBackend: etcd3
|
||||
kubeControllerManager:
|
||||
allocateNodeCIDRs: true
|
||||
attachDetachReconcileSyncPeriod: 1m0s
|
||||
cloudProvider: aws
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
clusterName: existing-iam.example.com
|
||||
configureCloudRoutes: true
|
||||
image: k8s.gcr.io/kube-controller-manager:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
useServiceAccountCredentials: true
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubeScheduler:
|
||||
image: k8s.gcr.io/kube-scheduler:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
masterKubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
registerSchedulable: false
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: existing-iam.example.com
|
||||
ConfigBase: memfs://tests/existing-iam.example.com
|
||||
InstanceGroupName: master-us-test-1b
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://tests/existing-iam.example.com/addons/bootstrap-channel.yaml
|
||||
etcdManifests:
|
||||
- memfs://tests/existing-iam.example.com/manifests/etcd/main.yaml
|
||||
- memfs://tests/existing-iam.example.com/manifests/etcd/events.yaml
|
||||
protokubeImage:
|
||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
||||
name: protokube:1.15.0
|
||||
sources:
|
||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
||||
- https://github.com/kubernetes/kops/releases/download/v1.15.0/images-protokube.tar.gz
|
||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
|
|
@ -1,302 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
encryptionConfig: null
|
||||
etcdClusters:
|
||||
events:
|
||||
version: 3.3.10
|
||||
main:
|
||||
version: 3.3.10
|
||||
kubeAPIServer:
|
||||
allowPrivileged: true
|
||||
anonymousAuth: false
|
||||
apiServerCount: 3
|
||||
authorizationMode: AlwaysAllow
|
||||
bindAddress: 0.0.0.0
|
||||
cloudProvider: aws
|
||||
enableAdmissionPlugins:
|
||||
- NamespaceLifecycle
|
||||
- LimitRanger
|
||||
- ServiceAccount
|
||||
- PersistentVolumeLabel
|
||||
- DefaultStorageClass
|
||||
- DefaultTolerationSeconds
|
||||
- MutatingAdmissionWebhook
|
||||
- ValidatingAdmissionWebhook
|
||||
- NodeRestriction
|
||||
- ResourceQuota
|
||||
etcdServers:
|
||||
- http://127.0.0.1:4001
|
||||
etcdServersOverrides:
|
||||
- /events#http://127.0.0.1:4002
|
||||
image: k8s.gcr.io/kube-apiserver:v1.14.0
|
||||
insecureBindAddress: 127.0.0.1
|
||||
insecurePort: 8080
|
||||
kubeletPreferredAddressTypes:
|
||||
- InternalIP
|
||||
- Hostname
|
||||
- ExternalIP
|
||||
logLevel: 2
|
||||
requestheaderAllowedNames:
|
||||
- aggregator
|
||||
requestheaderExtraHeaderPrefixes:
|
||||
- X-Remote-Extra-
|
||||
requestheaderGroupHeaders:
|
||||
- X-Remote-Group
|
||||
requestheaderUsernameHeaders:
|
||||
- X-Remote-User
|
||||
securePort: 443
|
||||
serviceClusterIPRange: 100.64.0.0/13
|
||||
storageBackend: etcd3
|
||||
kubeControllerManager:
|
||||
allocateNodeCIDRs: true
|
||||
attachDetachReconcileSyncPeriod: 1m0s
|
||||
cloudProvider: aws
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
clusterName: existing-iam.example.com
|
||||
configureCloudRoutes: true
|
||||
image: k8s.gcr.io/kube-controller-manager:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
useServiceAccountCredentials: true
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubeScheduler:
|
||||
image: k8s.gcr.io/kube-scheduler:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
masterKubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
registerSchedulable: false
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: existing-iam.example.com
|
||||
ConfigBase: memfs://tests/existing-iam.example.com
|
||||
InstanceGroupName: master-us-test-1c
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://tests/existing-iam.example.com/addons/bootstrap-channel.yaml
|
||||
etcdManifests:
|
||||
- memfs://tests/existing-iam.example.com/manifests/etcd/main.yaml
|
||||
- memfs://tests/existing-iam.example.com/manifests/etcd/events.yaml
|
||||
protokubeImage:
|
||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
||||
name: protokube:1.15.0
|
||||
sources:
|
||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
||||
- https://github.com/kubernetes/kops/releases/download/v1.15.0/images-protokube.tar.gz
|
||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
|
|
@ -1,209 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: existing-iam.example.com
|
||||
ConfigBase: memfs://tests/existing-iam.example.com
|
||||
InstanceGroupName: nodes
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://tests/existing-iam.example.com/addons/bootstrap-channel.yaml
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -71,12 +71,15 @@ provider "aws" {
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "master-us-test-1a-masters-existing-iam-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.master-us-test-1a-masters-existing-iam-example-com.id
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1a.masters.existing-iam.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.master-us-test-1a-masters-existing-iam-example-com.id
|
||||
version = aws_launch_template.master-us-test-1a-masters-existing-iam-example-com.latest_version
|
||||
}
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1a.masters.existing-iam.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -106,12 +109,15 @@ resource "aws_autoscaling_group" "master-us-test-1a-masters-existing-iam-example
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "master-us-test-1b-masters-existing-iam-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.master-us-test-1b-masters-existing-iam-example-com.id
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1b.masters.existing-iam.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.master-us-test-1b-masters-existing-iam-example-com.id
|
||||
version = aws_launch_template.master-us-test-1b-masters-existing-iam-example-com.latest_version
|
||||
}
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1b.masters.existing-iam.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -141,12 +147,15 @@ resource "aws_autoscaling_group" "master-us-test-1b-masters-existing-iam-example
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "master-us-test-1c-masters-existing-iam-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.master-us-test-1c-masters-existing-iam-example-com.id
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1c.masters.existing-iam.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.master-us-test-1c-masters-existing-iam-example-com.id
|
||||
version = aws_launch_template.master-us-test-1c-masters-existing-iam-example-com.latest_version
|
||||
}
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1c.masters.existing-iam.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -176,12 +185,15 @@ resource "aws_autoscaling_group" "master-us-test-1c-masters-existing-iam-example
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "nodes-existing-iam-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.nodes-existing-iam-example-com.id
|
||||
max_size = 2
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 2
|
||||
name = "nodes.existing-iam.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.nodes-existing-iam-example-com.id
|
||||
version = aws_launch_template.nodes-existing-iam-example-com.latest_version
|
||||
}
|
||||
max_size = 2
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 2
|
||||
name = "nodes.existing-iam.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -308,96 +320,204 @@ resource "aws_key_pair" "kubernetes-existing-iam-example-com-c4a6ed9aa889b9e2c39
|
|||
public_key = file("${path.module}/data/aws_key_pair_kubernetes.existing-iam.example.com-c4a6ed9aa889b9e2c39cd663eb9c7157_public_key")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "master-us-test-1a-masters-existing-iam-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
ephemeral_block_device {
|
||||
resource "aws_launch_template" "master-us-test-1a-masters-existing-iam-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
block_device_mappings {
|
||||
device_name = "/dev/sdc"
|
||||
virtual_name = "ephemeral0"
|
||||
}
|
||||
iam_instance_profile = "kops-custom-master-role"
|
||||
image_id = "ami-11400000"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-existing-iam-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
iam_instance_profile {
|
||||
name = "kops-custom-master-role"
|
||||
}
|
||||
image_id = "ami-11400000"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-existing-iam-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "master-us-test-1a.masters.existing-iam.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.masters-existing-iam-example-com.id]
|
||||
}
|
||||
security_groups = [aws_security_group.masters-existing-iam-example-com.id]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_master-us-test-1a.masters.existing-iam.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "existing-iam.example.com"
|
||||
"Name" = "master-us-test-1a.masters.existing-iam.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/existing-iam.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "existing-iam.example.com"
|
||||
"Name" = "master-us-test-1a.masters.existing-iam.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/existing-iam.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_master-us-test-1a.masters.existing-iam.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "master-us-test-1b-masters-existing-iam-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
ephemeral_block_device {
|
||||
resource "aws_launch_template" "master-us-test-1b-masters-existing-iam-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
block_device_mappings {
|
||||
device_name = "/dev/sdc"
|
||||
virtual_name = "ephemeral0"
|
||||
}
|
||||
iam_instance_profile = "kops-custom-master-role"
|
||||
image_id = "ami-11400000"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-existing-iam-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
iam_instance_profile {
|
||||
name = "kops-custom-master-role"
|
||||
}
|
||||
image_id = "ami-11400000"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-existing-iam-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "master-us-test-1b.masters.existing-iam.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.masters-existing-iam-example-com.id]
|
||||
}
|
||||
security_groups = [aws_security_group.masters-existing-iam-example-com.id]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_master-us-test-1b.masters.existing-iam.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "existing-iam.example.com"
|
||||
"Name" = "master-us-test-1b.masters.existing-iam.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1b"
|
||||
"kubernetes.io/cluster/existing-iam.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "existing-iam.example.com"
|
||||
"Name" = "master-us-test-1b.masters.existing-iam.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1b"
|
||||
"kubernetes.io/cluster/existing-iam.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_master-us-test-1b.masters.existing-iam.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "master-us-test-1c-masters-existing-iam-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
ephemeral_block_device {
|
||||
resource "aws_launch_template" "master-us-test-1c-masters-existing-iam-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
block_device_mappings {
|
||||
device_name = "/dev/sdc"
|
||||
virtual_name = "ephemeral0"
|
||||
}
|
||||
iam_instance_profile = "kops-custom-master-role"
|
||||
image_id = "ami-11400000"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-existing-iam-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
iam_instance_profile {
|
||||
name = "kops-custom-master-role"
|
||||
}
|
||||
image_id = "ami-11400000"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-existing-iam-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "master-us-test-1c.masters.existing-iam.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.masters-existing-iam-example-com.id]
|
||||
}
|
||||
security_groups = [aws_security_group.masters-existing-iam-example-com.id]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_master-us-test-1c.masters.existing-iam.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "existing-iam.example.com"
|
||||
"Name" = "master-us-test-1c.masters.existing-iam.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1c"
|
||||
"kubernetes.io/cluster/existing-iam.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "existing-iam.example.com"
|
||||
"Name" = "master-us-test-1c.masters.existing-iam.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1c"
|
||||
"kubernetes.io/cluster/existing-iam.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_master-us-test-1c.masters.existing-iam.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "nodes-existing-iam-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
iam_instance_profile = "kops-custom-node-role"
|
||||
image_id = "ami-11400000"
|
||||
instance_type = "t2.medium"
|
||||
key_name = aws_key_pair.kubernetes-existing-iam-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
resource "aws_launch_template" "nodes-existing-iam-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 128
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
iam_instance_profile {
|
||||
name = "kops-custom-node-role"
|
||||
}
|
||||
image_id = "ami-11400000"
|
||||
instance_type = "t2.medium"
|
||||
key_name = aws_key_pair.kubernetes-existing-iam-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "nodes.existing-iam.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 128
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.nodes-existing-iam-example-com.id]
|
||||
}
|
||||
security_groups = [aws_security_group.nodes-existing-iam-example-com.id]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_nodes.existing-iam.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "existing-iam.example.com"
|
||||
"Name" = "nodes.existing-iam.example.com"
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/existing-iam.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "existing-iam.example.com"
|
||||
"Name" = "nodes.existing-iam.example.com"
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/existing-iam.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_nodes.existing-iam.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_route_table_association" "us-test-1a-existing-iam-example-com" {
|
||||
|
|
|
|||
|
|
@ -4,8 +4,16 @@
|
|||
"Type": "AWS::AutoScaling::AutoScalingGroup",
|
||||
"Properties": {
|
||||
"AutoScalingGroupName": "master-us-test-1a.masters.minimal.example.com",
|
||||
"LaunchConfigurationName": {
|
||||
"Ref": "AWSAutoScalingLaunchConfigurationmasterustest1amastersminimalexamplecom"
|
||||
"LaunchTemplate": {
|
||||
"LaunchTemplateId": {
|
||||
"Ref": "AWSEC2LaunchTemplatemasterustest1amastersminimalexamplecom"
|
||||
},
|
||||
"Version": {
|
||||
"Fn::GetAtt": [
|
||||
"AWSEC2LaunchTemplatemasterustest1amastersminimalexamplecom",
|
||||
"LatestVersionNumber"
|
||||
]
|
||||
}
|
||||
},
|
||||
"MaxSize": 1,
|
||||
"MinSize": 1,
|
||||
|
|
@ -62,8 +70,16 @@
|
|||
"Type": "AWS::AutoScaling::AutoScalingGroup",
|
||||
"Properties": {
|
||||
"AutoScalingGroupName": "nodes.minimal.example.com",
|
||||
"LaunchConfigurationName": {
|
||||
"Ref": "AWSAutoScalingLaunchConfigurationnodesminimalexamplecom"
|
||||
"LaunchTemplate": {
|
||||
"LaunchTemplateId": {
|
||||
"Ref": "AWSEC2LaunchTemplatenodesminimalexamplecom"
|
||||
},
|
||||
"Version": {
|
||||
"Fn::GetAtt": [
|
||||
"AWSEC2LaunchTemplatenodesminimalexamplecom",
|
||||
"LatestVersionNumber"
|
||||
]
|
||||
}
|
||||
},
|
||||
"MaxSize": 2,
|
||||
"MinSize": 2,
|
||||
|
|
@ -116,64 +132,6 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"AWSAutoScalingLaunchConfigurationmasterustest1amastersminimalexamplecom": {
|
||||
"Type": "AWS::AutoScaling::LaunchConfiguration",
|
||||
"Properties": {
|
||||
"AssociatePublicIpAddress": true,
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 64,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeviceName": "/dev/sdc",
|
||||
"VirtualName": "ephemeral0"
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": "kops-custom-master-role",
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "m3.medium",
|
||||
"KeyName": "kubernetes.minimal.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"SecurityGroups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupmastersminimalexamplecom"
|
||||
}
|
||||
],
|
||||
"UserData": "extracted",
|
||||
"InstanceMonitoring": false
|
||||
}
|
||||
},
|
||||
"AWSAutoScalingLaunchConfigurationnodesminimalexamplecom": {
|
||||
"Type": "AWS::AutoScaling::LaunchConfiguration",
|
||||
"Properties": {
|
||||
"AssociatePublicIpAddress": true,
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 128,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": "kops-custom-node-role",
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "t2.medium",
|
||||
"KeyName": "kubernetes.minimal.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"SecurityGroups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupnodesminimalexamplecom"
|
||||
}
|
||||
],
|
||||
"UserData": "extracted",
|
||||
"InstanceMonitoring": false
|
||||
}
|
||||
},
|
||||
"AWSEC2DHCPOptionsminimalexamplecom": {
|
||||
"Type": "AWS::EC2::DHCPOptions",
|
||||
"Properties": {
|
||||
|
|
@ -216,6 +174,188 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"AWSEC2LaunchTemplatemasterustest1amastersminimalexamplecom": {
|
||||
"Type": "AWS::EC2::LaunchTemplate",
|
||||
"Properties": {
|
||||
"LaunchTemplateName": "master-us-test-1a.masters.minimal.example.com",
|
||||
"LaunchTemplateData": {
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 64,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeviceName": "/dev/sdc",
|
||||
"VirtualName": "ephemeral0"
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Name": "kops-custom-master-role"
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "m3.medium",
|
||||
"KeyName": "kubernetes.minimal.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"NetworkInterfaces": [
|
||||
{
|
||||
"AssociatePublicIpAddress": true,
|
||||
"DeleteOnTermination": true,
|
||||
"DeviceIndex": 0,
|
||||
"Groups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupmastersminimalexamplecom"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"TagSpecifications": [
|
||||
{
|
||||
"ResourceType": "instance",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "minimal.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "master-us-test-1a.masters.minimal.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/master",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "master-us-test-1a"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/minimal.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ResourceType": "volume",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "minimal.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "master-us-test-1a.masters.minimal.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/master",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "master-us-test-1a"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/minimal.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"UserData": "extracted"
|
||||
}
|
||||
}
|
||||
},
|
||||
"AWSEC2LaunchTemplatenodesminimalexamplecom": {
|
||||
"Type": "AWS::EC2::LaunchTemplate",
|
||||
"Properties": {
|
||||
"LaunchTemplateName": "nodes.minimal.example.com",
|
||||
"LaunchTemplateData": {
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 128,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Name": "kops-custom-node-role"
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "t2.medium",
|
||||
"KeyName": "kubernetes.minimal.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"NetworkInterfaces": [
|
||||
{
|
||||
"AssociatePublicIpAddress": true,
|
||||
"DeleteOnTermination": true,
|
||||
"DeviceIndex": 0,
|
||||
"Groups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupnodesminimalexamplecom"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"TagSpecifications": [
|
||||
{
|
||||
"ResourceType": "instance",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "minimal.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "nodes.minimal.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/node",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "nodes"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/minimal.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ResourceType": "volume",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "minimal.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "nodes.minimal.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/node",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "nodes"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/minimal.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"UserData": "extracted"
|
||||
}
|
||||
}
|
||||
},
|
||||
"AWSEC2Route00000": {
|
||||
"Type": "AWS::EC2::Route",
|
||||
"Properties": {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Resources.AWSAutoScalingLaunchConfigurationmasterustest1amastersminimalexamplecom.Properties.UserData: |
|
||||
Resources.AWSEC2LaunchTemplatemasterustest1amastersminimalexamplecom.Properties.LaunchTemplateData.UserData: |
|
||||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
|
|
@ -301,7 +301,7 @@ Resources.AWSAutoScalingLaunchConfigurationmasterustest1amastersminimalexampleco
|
|||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
Resources.AWSAutoScalingLaunchConfigurationnodesminimalexamplecom.Properties.UserData: |
|
||||
Resources.AWSEC2LaunchTemplatenodesminimalexamplecom.Properties.LaunchTemplateData.UserData: |
|
||||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -1,302 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
encryptionConfig: null
|
||||
etcdClusters:
|
||||
events:
|
||||
version: 3.3.10
|
||||
main:
|
||||
version: 3.3.10
|
||||
kubeAPIServer:
|
||||
allowPrivileged: true
|
||||
anonymousAuth: false
|
||||
apiServerCount: 3
|
||||
authorizationMode: AlwaysAllow
|
||||
bindAddress: 0.0.0.0
|
||||
cloudProvider: aws
|
||||
enableAdmissionPlugins:
|
||||
- NamespaceLifecycle
|
||||
- LimitRanger
|
||||
- ServiceAccount
|
||||
- PersistentVolumeLabel
|
||||
- DefaultStorageClass
|
||||
- DefaultTolerationSeconds
|
||||
- MutatingAdmissionWebhook
|
||||
- ValidatingAdmissionWebhook
|
||||
- NodeRestriction
|
||||
- ResourceQuota
|
||||
etcdServers:
|
||||
- http://127.0.0.1:4001
|
||||
etcdServersOverrides:
|
||||
- /events#http://127.0.0.1:4002
|
||||
image: k8s.gcr.io/kube-apiserver:v1.14.0
|
||||
insecureBindAddress: 127.0.0.1
|
||||
insecurePort: 8080
|
||||
kubeletPreferredAddressTypes:
|
||||
- InternalIP
|
||||
- Hostname
|
||||
- ExternalIP
|
||||
logLevel: 2
|
||||
requestheaderAllowedNames:
|
||||
- aggregator
|
||||
requestheaderExtraHeaderPrefixes:
|
||||
- X-Remote-Extra-
|
||||
requestheaderGroupHeaders:
|
||||
- X-Remote-Group
|
||||
requestheaderUsernameHeaders:
|
||||
- X-Remote-User
|
||||
securePort: 443
|
||||
serviceClusterIPRange: 100.64.0.0/13
|
||||
storageBackend: etcd3
|
||||
kubeControllerManager:
|
||||
allocateNodeCIDRs: true
|
||||
attachDetachReconcileSyncPeriod: 1m0s
|
||||
cloudProvider: aws
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
clusterName: existingsg.example.com
|
||||
configureCloudRoutes: true
|
||||
image: k8s.gcr.io/kube-controller-manager:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
useServiceAccountCredentials: true
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubeScheduler:
|
||||
image: k8s.gcr.io/kube-scheduler:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
masterKubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
registerSchedulable: false
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: existingsg.example.com
|
||||
ConfigBase: memfs://clusters.example.com/existingsg.example.com
|
||||
InstanceGroupName: master-us-test-1a
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/existingsg.example.com/addons/bootstrap-channel.yaml
|
||||
etcdManifests:
|
||||
- memfs://clusters.example.com/existingsg.example.com/manifests/etcd/main.yaml
|
||||
- memfs://clusters.example.com/existingsg.example.com/manifests/etcd/events.yaml
|
||||
protokubeImage:
|
||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
||||
name: protokube:1.15.0
|
||||
sources:
|
||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
||||
- https://github.com/kubernetes/kops/releases/download/v1.15.0/images-protokube.tar.gz
|
||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
|
|
@ -1,302 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
encryptionConfig: null
|
||||
etcdClusters:
|
||||
events:
|
||||
version: 3.3.10
|
||||
main:
|
||||
version: 3.3.10
|
||||
kubeAPIServer:
|
||||
allowPrivileged: true
|
||||
anonymousAuth: false
|
||||
apiServerCount: 3
|
||||
authorizationMode: AlwaysAllow
|
||||
bindAddress: 0.0.0.0
|
||||
cloudProvider: aws
|
||||
enableAdmissionPlugins:
|
||||
- NamespaceLifecycle
|
||||
- LimitRanger
|
||||
- ServiceAccount
|
||||
- PersistentVolumeLabel
|
||||
- DefaultStorageClass
|
||||
- DefaultTolerationSeconds
|
||||
- MutatingAdmissionWebhook
|
||||
- ValidatingAdmissionWebhook
|
||||
- NodeRestriction
|
||||
- ResourceQuota
|
||||
etcdServers:
|
||||
- http://127.0.0.1:4001
|
||||
etcdServersOverrides:
|
||||
- /events#http://127.0.0.1:4002
|
||||
image: k8s.gcr.io/kube-apiserver:v1.14.0
|
||||
insecureBindAddress: 127.0.0.1
|
||||
insecurePort: 8080
|
||||
kubeletPreferredAddressTypes:
|
||||
- InternalIP
|
||||
- Hostname
|
||||
- ExternalIP
|
||||
logLevel: 2
|
||||
requestheaderAllowedNames:
|
||||
- aggregator
|
||||
requestheaderExtraHeaderPrefixes:
|
||||
- X-Remote-Extra-
|
||||
requestheaderGroupHeaders:
|
||||
- X-Remote-Group
|
||||
requestheaderUsernameHeaders:
|
||||
- X-Remote-User
|
||||
securePort: 443
|
||||
serviceClusterIPRange: 100.64.0.0/13
|
||||
storageBackend: etcd3
|
||||
kubeControllerManager:
|
||||
allocateNodeCIDRs: true
|
||||
attachDetachReconcileSyncPeriod: 1m0s
|
||||
cloudProvider: aws
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
clusterName: existingsg.example.com
|
||||
configureCloudRoutes: true
|
||||
image: k8s.gcr.io/kube-controller-manager:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
useServiceAccountCredentials: true
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubeScheduler:
|
||||
image: k8s.gcr.io/kube-scheduler:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
masterKubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
registerSchedulable: false
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: existingsg.example.com
|
||||
ConfigBase: memfs://clusters.example.com/existingsg.example.com
|
||||
InstanceGroupName: master-us-test-1b
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/existingsg.example.com/addons/bootstrap-channel.yaml
|
||||
etcdManifests:
|
||||
- memfs://clusters.example.com/existingsg.example.com/manifests/etcd/main.yaml
|
||||
- memfs://clusters.example.com/existingsg.example.com/manifests/etcd/events.yaml
|
||||
protokubeImage:
|
||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
||||
name: protokube:1.15.0
|
||||
sources:
|
||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
||||
- https://github.com/kubernetes/kops/releases/download/v1.15.0/images-protokube.tar.gz
|
||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
|
|
@ -1,302 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
encryptionConfig: null
|
||||
etcdClusters:
|
||||
events:
|
||||
version: 3.3.10
|
||||
main:
|
||||
version: 3.3.10
|
||||
kubeAPIServer:
|
||||
allowPrivileged: true
|
||||
anonymousAuth: false
|
||||
apiServerCount: 3
|
||||
authorizationMode: AlwaysAllow
|
||||
bindAddress: 0.0.0.0
|
||||
cloudProvider: aws
|
||||
enableAdmissionPlugins:
|
||||
- NamespaceLifecycle
|
||||
- LimitRanger
|
||||
- ServiceAccount
|
||||
- PersistentVolumeLabel
|
||||
- DefaultStorageClass
|
||||
- DefaultTolerationSeconds
|
||||
- MutatingAdmissionWebhook
|
||||
- ValidatingAdmissionWebhook
|
||||
- NodeRestriction
|
||||
- ResourceQuota
|
||||
etcdServers:
|
||||
- http://127.0.0.1:4001
|
||||
etcdServersOverrides:
|
||||
- /events#http://127.0.0.1:4002
|
||||
image: k8s.gcr.io/kube-apiserver:v1.14.0
|
||||
insecureBindAddress: 127.0.0.1
|
||||
insecurePort: 8080
|
||||
kubeletPreferredAddressTypes:
|
||||
- InternalIP
|
||||
- Hostname
|
||||
- ExternalIP
|
||||
logLevel: 2
|
||||
requestheaderAllowedNames:
|
||||
- aggregator
|
||||
requestheaderExtraHeaderPrefixes:
|
||||
- X-Remote-Extra-
|
||||
requestheaderGroupHeaders:
|
||||
- X-Remote-Group
|
||||
requestheaderUsernameHeaders:
|
||||
- X-Remote-User
|
||||
securePort: 443
|
||||
serviceClusterIPRange: 100.64.0.0/13
|
||||
storageBackend: etcd3
|
||||
kubeControllerManager:
|
||||
allocateNodeCIDRs: true
|
||||
attachDetachReconcileSyncPeriod: 1m0s
|
||||
cloudProvider: aws
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
clusterName: existingsg.example.com
|
||||
configureCloudRoutes: true
|
||||
image: k8s.gcr.io/kube-controller-manager:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
useServiceAccountCredentials: true
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubeScheduler:
|
||||
image: k8s.gcr.io/kube-scheduler:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
masterKubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
registerSchedulable: false
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: existingsg.example.com
|
||||
ConfigBase: memfs://clusters.example.com/existingsg.example.com
|
||||
InstanceGroupName: master-us-test-1c
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/existingsg.example.com/addons/bootstrap-channel.yaml
|
||||
etcdManifests:
|
||||
- memfs://clusters.example.com/existingsg.example.com/manifests/etcd/main.yaml
|
||||
- memfs://clusters.example.com/existingsg.example.com/manifests/etcd/events.yaml
|
||||
protokubeImage:
|
||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
||||
name: protokube:1.15.0
|
||||
sources:
|
||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
||||
- https://github.com/kubernetes/kops/releases/download/v1.15.0/images-protokube.tar.gz
|
||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
|
|
@ -1,209 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: existingsg.example.com
|
||||
ConfigBase: memfs://clusters.example.com/existingsg.example.com
|
||||
InstanceGroupName: nodes
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/existingsg.example.com/addons/bootstrap-channel.yaml
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -106,12 +106,15 @@ resource "aws_autoscaling_attachment" "master-us-test-1c-masters-existingsg-exam
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "master-us-test-1a-masters-existingsg-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.master-us-test-1a-masters-existingsg-example-com.id
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1a.masters.existingsg.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.master-us-test-1a-masters-existingsg-example-com.id
|
||||
version = aws_launch_template.master-us-test-1a-masters-existingsg-example-com.latest_version
|
||||
}
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1a.masters.existingsg.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -141,12 +144,15 @@ resource "aws_autoscaling_group" "master-us-test-1a-masters-existingsg-example-c
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "master-us-test-1b-masters-existingsg-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.master-us-test-1b-masters-existingsg-example-com.id
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1b.masters.existingsg.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.master-us-test-1b-masters-existingsg-example-com.id
|
||||
version = aws_launch_template.master-us-test-1b-masters-existingsg-example-com.latest_version
|
||||
}
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1b.masters.existingsg.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -176,12 +182,15 @@ resource "aws_autoscaling_group" "master-us-test-1b-masters-existingsg-example-c
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "master-us-test-1c-masters-existingsg-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.master-us-test-1c-masters-existingsg-example-com.id
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1c.masters.existingsg.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.master-us-test-1c-masters-existingsg-example-com.id
|
||||
version = aws_launch_template.master-us-test-1c-masters-existingsg-example-com.latest_version
|
||||
}
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1c.masters.existingsg.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -211,12 +220,15 @@ resource "aws_autoscaling_group" "master-us-test-1c-masters-existingsg-example-c
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "nodes-existingsg-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.nodes-existingsg-example-com.id
|
||||
max_size = 2
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 2
|
||||
name = "nodes.existingsg.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.nodes-existingsg-example-com.id
|
||||
version = aws_launch_template.nodes-existingsg-example-com.latest_version
|
||||
}
|
||||
max_size = 2
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 2
|
||||
name = "nodes.existingsg.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -402,96 +414,204 @@ resource "aws_key_pair" "kubernetes-existingsg-example-com-c4a6ed9aa889b9e2c39cd
|
|||
public_key = file("${path.module}/data/aws_key_pair_kubernetes.existingsg.example.com-c4a6ed9aa889b9e2c39cd663eb9c7157_public_key")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "master-us-test-1a-masters-existingsg-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
ephemeral_block_device {
|
||||
resource "aws_launch_template" "master-us-test-1a-masters-existingsg-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
block_device_mappings {
|
||||
device_name = "/dev/sdc"
|
||||
virtual_name = "ephemeral0"
|
||||
}
|
||||
iam_instance_profile = aws_iam_instance_profile.masters-existingsg-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-existingsg-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.masters-existingsg-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-existingsg-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "master-us-test-1a.masters.existingsg.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = ["sg-master-1a"]
|
||||
}
|
||||
security_groups = ["sg-master-1a"]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_master-us-test-1a.masters.existingsg.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "existingsg.example.com"
|
||||
"Name" = "master-us-test-1a.masters.existingsg.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/existingsg.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "existingsg.example.com"
|
||||
"Name" = "master-us-test-1a.masters.existingsg.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/existingsg.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_master-us-test-1a.masters.existingsg.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "master-us-test-1b-masters-existingsg-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
ephemeral_block_device {
|
||||
resource "aws_launch_template" "master-us-test-1b-masters-existingsg-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
block_device_mappings {
|
||||
device_name = "/dev/sdc"
|
||||
virtual_name = "ephemeral0"
|
||||
}
|
||||
iam_instance_profile = aws_iam_instance_profile.masters-existingsg-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-existingsg-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.masters-existingsg-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-existingsg-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "master-us-test-1b.masters.existingsg.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = ["sg-master-1b"]
|
||||
}
|
||||
security_groups = ["sg-master-1b"]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_master-us-test-1b.masters.existingsg.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "existingsg.example.com"
|
||||
"Name" = "master-us-test-1b.masters.existingsg.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1b"
|
||||
"kubernetes.io/cluster/existingsg.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "existingsg.example.com"
|
||||
"Name" = "master-us-test-1b.masters.existingsg.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1b"
|
||||
"kubernetes.io/cluster/existingsg.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_master-us-test-1b.masters.existingsg.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "master-us-test-1c-masters-existingsg-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
ephemeral_block_device {
|
||||
resource "aws_launch_template" "master-us-test-1c-masters-existingsg-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
block_device_mappings {
|
||||
device_name = "/dev/sdc"
|
||||
virtual_name = "ephemeral0"
|
||||
}
|
||||
iam_instance_profile = aws_iam_instance_profile.masters-existingsg-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-existingsg-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.masters-existingsg-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-existingsg-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "master-us-test-1c.masters.existingsg.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.masters-existingsg-example-com.id]
|
||||
}
|
||||
security_groups = [aws_security_group.masters-existingsg-example-com.id]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_master-us-test-1c.masters.existingsg.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "existingsg.example.com"
|
||||
"Name" = "master-us-test-1c.masters.existingsg.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1c"
|
||||
"kubernetes.io/cluster/existingsg.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "existingsg.example.com"
|
||||
"Name" = "master-us-test-1c.masters.existingsg.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1c"
|
||||
"kubernetes.io/cluster/existingsg.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_master-us-test-1c.masters.existingsg.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "nodes-existingsg-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
iam_instance_profile = aws_iam_instance_profile.nodes-existingsg-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t2.medium"
|
||||
key_name = aws_key_pair.kubernetes-existingsg-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
resource "aws_launch_template" "nodes-existingsg-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 128
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.nodes-existingsg-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t2.medium"
|
||||
key_name = aws_key_pair.kubernetes-existingsg-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "nodes.existingsg.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 128
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = ["sg-nodes"]
|
||||
}
|
||||
security_groups = ["sg-nodes"]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_nodes.existingsg.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "existingsg.example.com"
|
||||
"Name" = "nodes.existingsg.example.com"
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/existingsg.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "existingsg.example.com"
|
||||
"Name" = "nodes.existingsg.example.com"
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/existingsg.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_nodes.existingsg.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_route53_record" "api-existingsg-example-com" {
|
||||
|
|
|
|||
|
|
@ -4,8 +4,16 @@
|
|||
"Type": "AWS::AutoScaling::AutoScalingGroup",
|
||||
"Properties": {
|
||||
"AutoScalingGroupName": "master-us-test-1a.masters.externallb.example.com",
|
||||
"LaunchConfigurationName": {
|
||||
"Ref": "AWSAutoScalingLaunchConfigurationmasterustest1amastersexternallbexamplecom"
|
||||
"LaunchTemplate": {
|
||||
"LaunchTemplateId": {
|
||||
"Ref": "AWSEC2LaunchTemplatemasterustest1amastersexternallbexamplecom"
|
||||
},
|
||||
"Version": {
|
||||
"Fn::GetAtt": [
|
||||
"AWSEC2LaunchTemplatemasterustest1amastersexternallbexamplecom",
|
||||
"LatestVersionNumber"
|
||||
]
|
||||
}
|
||||
},
|
||||
"MaxSize": 1,
|
||||
"MinSize": 1,
|
||||
|
|
@ -68,8 +76,16 @@
|
|||
"Type": "AWS::AutoScaling::AutoScalingGroup",
|
||||
"Properties": {
|
||||
"AutoScalingGroupName": "nodes.externallb.example.com",
|
||||
"LaunchConfigurationName": {
|
||||
"Ref": "AWSAutoScalingLaunchConfigurationnodesexternallbexamplecom"
|
||||
"LaunchTemplate": {
|
||||
"LaunchTemplateId": {
|
||||
"Ref": "AWSEC2LaunchTemplatenodesexternallbexamplecom"
|
||||
},
|
||||
"Version": {
|
||||
"Fn::GetAtt": [
|
||||
"AWSEC2LaunchTemplatenodesexternallbexamplecom",
|
||||
"LatestVersionNumber"
|
||||
]
|
||||
}
|
||||
},
|
||||
"MaxSize": 2,
|
||||
"MinSize": 2,
|
||||
|
|
@ -125,68 +141,6 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"AWSAutoScalingLaunchConfigurationmasterustest1amastersexternallbexamplecom": {
|
||||
"Type": "AWS::AutoScaling::LaunchConfiguration",
|
||||
"Properties": {
|
||||
"AssociatePublicIpAddress": true,
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 64,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeviceName": "/dev/sdc",
|
||||
"VirtualName": "ephemeral0"
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Ref": "AWSIAMInstanceProfilemastersexternallbexamplecom"
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "m3.medium",
|
||||
"KeyName": "kubernetes.externallb.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"SecurityGroups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupmastersexternallbexamplecom"
|
||||
}
|
||||
],
|
||||
"UserData": "extracted",
|
||||
"InstanceMonitoring": false
|
||||
}
|
||||
},
|
||||
"AWSAutoScalingLaunchConfigurationnodesexternallbexamplecom": {
|
||||
"Type": "AWS::AutoScaling::LaunchConfiguration",
|
||||
"Properties": {
|
||||
"AssociatePublicIpAddress": true,
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 128,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Ref": "AWSIAMInstanceProfilenodesexternallbexamplecom"
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "t2.medium",
|
||||
"KeyName": "kubernetes.externallb.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"SecurityGroups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupnodesexternallbexamplecom"
|
||||
}
|
||||
],
|
||||
"UserData": "extracted",
|
||||
"InstanceMonitoring": false
|
||||
}
|
||||
},
|
||||
"AWSEC2DHCPOptionsexternallbexamplecom": {
|
||||
"Type": "AWS::EC2::DHCPOptions",
|
||||
"Properties": {
|
||||
|
|
@ -229,6 +183,192 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"AWSEC2LaunchTemplatemasterustest1amastersexternallbexamplecom": {
|
||||
"Type": "AWS::EC2::LaunchTemplate",
|
||||
"Properties": {
|
||||
"LaunchTemplateName": "master-us-test-1a.masters.externallb.example.com",
|
||||
"LaunchTemplateData": {
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 64,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeviceName": "/dev/sdc",
|
||||
"VirtualName": "ephemeral0"
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Name": {
|
||||
"Ref": "AWSIAMInstanceProfilemastersexternallbexamplecom"
|
||||
}
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "m3.medium",
|
||||
"KeyName": "kubernetes.externallb.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"NetworkInterfaces": [
|
||||
{
|
||||
"AssociatePublicIpAddress": true,
|
||||
"DeleteOnTermination": true,
|
||||
"DeviceIndex": 0,
|
||||
"Groups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupmastersexternallbexamplecom"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"TagSpecifications": [
|
||||
{
|
||||
"ResourceType": "instance",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "externallb.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "master-us-test-1a.masters.externallb.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/master",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "master-us-test-1a"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/externallb.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ResourceType": "volume",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "externallb.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "master-us-test-1a.masters.externallb.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/master",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "master-us-test-1a"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/externallb.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"UserData": "extracted"
|
||||
}
|
||||
}
|
||||
},
|
||||
"AWSEC2LaunchTemplatenodesexternallbexamplecom": {
|
||||
"Type": "AWS::EC2::LaunchTemplate",
|
||||
"Properties": {
|
||||
"LaunchTemplateName": "nodes.externallb.example.com",
|
||||
"LaunchTemplateData": {
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 128,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Name": {
|
||||
"Ref": "AWSIAMInstanceProfilenodesexternallbexamplecom"
|
||||
}
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "t2.medium",
|
||||
"KeyName": "kubernetes.externallb.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"NetworkInterfaces": [
|
||||
{
|
||||
"AssociatePublicIpAddress": true,
|
||||
"DeleteOnTermination": true,
|
||||
"DeviceIndex": 0,
|
||||
"Groups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupnodesexternallbexamplecom"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"TagSpecifications": [
|
||||
{
|
||||
"ResourceType": "instance",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "externallb.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "nodes.externallb.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/node",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "nodes"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/externallb.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ResourceType": "volume",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "externallb.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "nodes.externallb.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/node",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "nodes"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/externallb.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"UserData": "extracted"
|
||||
}
|
||||
}
|
||||
},
|
||||
"AWSEC2Route00000": {
|
||||
"Type": "AWS::EC2::Route",
|
||||
"Properties": {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Resources.AWSAutoScalingLaunchConfigurationmasterustest1amastersexternallbexamplecom.Properties.UserData: |
|
||||
Resources.AWSEC2LaunchTemplatemasterustest1amastersexternallbexamplecom.Properties.LaunchTemplateData.UserData: |
|
||||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
|
|
@ -301,7 +301,7 @@ Resources.AWSAutoScalingLaunchConfigurationmasterustest1amastersexternallbexampl
|
|||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
Resources.AWSAutoScalingLaunchConfigurationnodesexternallbexamplecom.Properties.UserData: |
|
||||
Resources.AWSEC2LaunchTemplatenodesexternallbexamplecom.Properties.LaunchTemplateData.UserData: |
|
||||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -1,302 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
encryptionConfig: null
|
||||
etcdClusters:
|
||||
events:
|
||||
version: 3.3.10
|
||||
main:
|
||||
version: 3.3.10
|
||||
kubeAPIServer:
|
||||
allowPrivileged: true
|
||||
anonymousAuth: false
|
||||
apiServerCount: 1
|
||||
authorizationMode: AlwaysAllow
|
||||
bindAddress: 0.0.0.0
|
||||
cloudProvider: aws
|
||||
enableAdmissionPlugins:
|
||||
- NamespaceLifecycle
|
||||
- LimitRanger
|
||||
- ServiceAccount
|
||||
- PersistentVolumeLabel
|
||||
- DefaultStorageClass
|
||||
- DefaultTolerationSeconds
|
||||
- MutatingAdmissionWebhook
|
||||
- ValidatingAdmissionWebhook
|
||||
- NodeRestriction
|
||||
- ResourceQuota
|
||||
etcdServers:
|
||||
- http://127.0.0.1:4001
|
||||
etcdServersOverrides:
|
||||
- /events#http://127.0.0.1:4002
|
||||
image: k8s.gcr.io/kube-apiserver:v1.14.0
|
||||
insecureBindAddress: 127.0.0.1
|
||||
insecurePort: 8080
|
||||
kubeletPreferredAddressTypes:
|
||||
- InternalIP
|
||||
- Hostname
|
||||
- ExternalIP
|
||||
logLevel: 2
|
||||
requestheaderAllowedNames:
|
||||
- aggregator
|
||||
requestheaderExtraHeaderPrefixes:
|
||||
- X-Remote-Extra-
|
||||
requestheaderGroupHeaders:
|
||||
- X-Remote-Group
|
||||
requestheaderUsernameHeaders:
|
||||
- X-Remote-User
|
||||
securePort: 443
|
||||
serviceClusterIPRange: 100.64.0.0/13
|
||||
storageBackend: etcd3
|
||||
kubeControllerManager:
|
||||
allocateNodeCIDRs: true
|
||||
attachDetachReconcileSyncPeriod: 1m0s
|
||||
cloudProvider: aws
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
clusterName: externallb.example.com
|
||||
configureCloudRoutes: true
|
||||
image: k8s.gcr.io/kube-controller-manager:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
useServiceAccountCredentials: true
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubeScheduler:
|
||||
image: k8s.gcr.io/kube-scheduler:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
masterKubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
registerSchedulable: false
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: externallb.example.com
|
||||
ConfigBase: memfs://clusters.example.com/externallb.example.com
|
||||
InstanceGroupName: master-us-test-1a
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/externallb.example.com/addons/bootstrap-channel.yaml
|
||||
etcdManifests:
|
||||
- memfs://clusters.example.com/externallb.example.com/manifests/etcd/main.yaml
|
||||
- memfs://clusters.example.com/externallb.example.com/manifests/etcd/events.yaml
|
||||
protokubeImage:
|
||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
||||
name: protokube:1.15.0
|
||||
sources:
|
||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
||||
- https://github.com/kubernetes/kops/releases/download/v1.15.0/images-protokube.tar.gz
|
||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
|
|
@ -1,209 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: externallb.example.com
|
||||
ConfigBase: memfs://clusters.example.com/externallb.example.com
|
||||
InstanceGroupName: nodes
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/externallb.example.com/addons/bootstrap-channel.yaml
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -96,12 +96,15 @@ resource "aws_autoscaling_attachment" "exttg-aws_my-tg--0123456789abcdef-master-
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "master-us-test-1a-masters-externallb-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.master-us-test-1a-masters-externallb-example-com.id
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1a.masters.externallb.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.master-us-test-1a-masters-externallb-example-com.id
|
||||
version = aws_launch_template.master-us-test-1a-masters-externallb-example-com.latest_version
|
||||
}
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1a.masters.externallb.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -131,12 +134,15 @@ resource "aws_autoscaling_group" "master-us-test-1a-masters-externallb-example-c
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "nodes-externallb-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.nodes-externallb-example-com.id
|
||||
max_size = 2
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 2
|
||||
name = "nodes.externallb.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.nodes-externallb-example-com.id
|
||||
version = aws_launch_template.nodes-externallb-example-com.latest_version
|
||||
}
|
||||
max_size = 2
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 2
|
||||
name = "nodes.externallb.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -239,48 +245,102 @@ resource "aws_key_pair" "kubernetes-externallb-example-com-c4a6ed9aa889b9e2c39cd
|
|||
public_key = file("${path.module}/data/aws_key_pair_kubernetes.externallb.example.com-c4a6ed9aa889b9e2c39cd663eb9c7157_public_key")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "master-us-test-1a-masters-externallb-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
ephemeral_block_device {
|
||||
resource "aws_launch_template" "master-us-test-1a-masters-externallb-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
block_device_mappings {
|
||||
device_name = "/dev/sdc"
|
||||
virtual_name = "ephemeral0"
|
||||
}
|
||||
iam_instance_profile = aws_iam_instance_profile.masters-externallb-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-externallb-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.masters-externallb-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-externallb-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "master-us-test-1a.masters.externallb.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.masters-externallb-example-com.id]
|
||||
}
|
||||
security_groups = [aws_security_group.masters-externallb-example-com.id]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_master-us-test-1a.masters.externallb.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "externallb.example.com"
|
||||
"Name" = "master-us-test-1a.masters.externallb.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/externallb.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "externallb.example.com"
|
||||
"Name" = "master-us-test-1a.masters.externallb.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/externallb.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_master-us-test-1a.masters.externallb.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "nodes-externallb-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
iam_instance_profile = aws_iam_instance_profile.nodes-externallb-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t2.medium"
|
||||
key_name = aws_key_pair.kubernetes-externallb-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
resource "aws_launch_template" "nodes-externallb-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 128
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.nodes-externallb-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t2.medium"
|
||||
key_name = aws_key_pair.kubernetes-externallb-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "nodes.externallb.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 128
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.nodes-externallb-example-com.id]
|
||||
}
|
||||
security_groups = [aws_security_group.nodes-externallb-example-com.id]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_nodes.externallb.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "externallb.example.com"
|
||||
"Name" = "nodes.externallb.example.com"
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/externallb.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "externallb.example.com"
|
||||
"Name" = "nodes.externallb.example.com"
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/externallb.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_nodes.externallb.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_route_table_association" "us-test-1a-externallb-example-com" {
|
||||
|
|
|
|||
|
|
@ -1,304 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
encryptionConfig: null
|
||||
etcdClusters:
|
||||
events:
|
||||
version: 3.3.10
|
||||
main:
|
||||
version: 3.3.10
|
||||
kubeAPIServer:
|
||||
allowPrivileged: true
|
||||
anonymousAuth: false
|
||||
apiServerCount: 1
|
||||
auditWebhookBatchThrottleQps: 3140m
|
||||
authorizationMode: AlwaysAllow
|
||||
bindAddress: 0.0.0.0
|
||||
cloudProvider: aws
|
||||
enableAdmissionPlugins:
|
||||
- NamespaceLifecycle
|
||||
- LimitRanger
|
||||
- ServiceAccount
|
||||
- PersistentVolumeLabel
|
||||
- DefaultStorageClass
|
||||
- DefaultTolerationSeconds
|
||||
- MutatingAdmissionWebhook
|
||||
- ValidatingAdmissionWebhook
|
||||
- NodeRestriction
|
||||
- ResourceQuota
|
||||
etcdServers:
|
||||
- http://127.0.0.1:4001
|
||||
etcdServersOverrides:
|
||||
- /events#http://127.0.0.1:4002
|
||||
image: k8s.gcr.io/kube-apiserver:v1.14.0
|
||||
insecureBindAddress: 127.0.0.1
|
||||
insecurePort: 8080
|
||||
kubeletPreferredAddressTypes:
|
||||
- InternalIP
|
||||
- Hostname
|
||||
- ExternalIP
|
||||
logLevel: 2
|
||||
requestheaderAllowedNames:
|
||||
- aggregator
|
||||
requestheaderExtraHeaderPrefixes:
|
||||
- X-Remote-Extra-
|
||||
requestheaderGroupHeaders:
|
||||
- X-Remote-Group
|
||||
requestheaderUsernameHeaders:
|
||||
- X-Remote-User
|
||||
securePort: 443
|
||||
serviceClusterIPRange: 100.64.0.0/13
|
||||
serviceNodePortRange: 28000-32767
|
||||
storageBackend: etcd3
|
||||
kubeControllerManager:
|
||||
allocateNodeCIDRs: true
|
||||
attachDetachReconcileSyncPeriod: 1m0s
|
||||
cloudProvider: aws
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
clusterName: externalpolicies.example.com
|
||||
configureCloudRoutes: true
|
||||
image: k8s.gcr.io/kube-controller-manager:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
useServiceAccountCredentials: true
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubeScheduler:
|
||||
image: k8s.gcr.io/kube-scheduler:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
masterKubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
registerSchedulable: false
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: externalpolicies.example.com
|
||||
ConfigBase: memfs://clusters.example.com/externalpolicies.example.com
|
||||
InstanceGroupName: master-us-test-1a
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/externalpolicies.example.com/addons/bootstrap-channel.yaml
|
||||
etcdManifests:
|
||||
- memfs://clusters.example.com/externalpolicies.example.com/manifests/etcd/main.yaml
|
||||
- memfs://clusters.example.com/externalpolicies.example.com/manifests/etcd/events.yaml
|
||||
protokubeImage:
|
||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
||||
name: protokube:1.15.0
|
||||
sources:
|
||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
||||
- https://github.com/kubernetes/kops/releases/download/v1.15.0/images-protokube.tar.gz
|
||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
|
|
@ -1,209 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: externalpolicies.example.com
|
||||
ConfigBase: memfs://clusters.example.com/externalpolicies.example.com
|
||||
InstanceGroupName: nodes
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/externalpolicies.example.com/addons/bootstrap-channel.yaml
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -86,12 +86,15 @@ resource "aws_autoscaling_attachment" "master-us-test-1a-masters-externalpolicie
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "master-us-test-1a-masters-externalpolicies-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.master-us-test-1a-masters-externalpolicies-example-com.id
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1a.masters.externalpolicies.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.master-us-test-1a-masters-externalpolicies-example-com.id
|
||||
version = aws_launch_template.master-us-test-1a-masters-externalpolicies-example-com.latest_version
|
||||
}
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1a.masters.externalpolicies.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -131,13 +134,16 @@ resource "aws_autoscaling_group" "master-us-test-1a-masters-externalpolicies-exa
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "nodes-externalpolicies-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.nodes-externalpolicies-example-com.id
|
||||
max_size = 2
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 2
|
||||
name = "nodes.externalpolicies.example.com"
|
||||
suspended_processes = ["AZRebalance"]
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.nodes-externalpolicies-example-com.id
|
||||
version = aws_launch_template.nodes-externalpolicies-example-com.latest_version
|
||||
}
|
||||
max_size = 2
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 2
|
||||
name = "nodes.externalpolicies.example.com"
|
||||
suspended_processes = ["AZRebalance"]
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -295,48 +301,110 @@ resource "aws_key_pair" "kubernetes-externalpolicies-example-com-c4a6ed9aa889b9e
|
|||
public_key = file("${path.module}/data/aws_key_pair_kubernetes.externalpolicies.example.com-c4a6ed9aa889b9e2c39cd663eb9c7157_public_key")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "master-us-test-1a-masters-externalpolicies-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
ephemeral_block_device {
|
||||
resource "aws_launch_template" "master-us-test-1a-masters-externalpolicies-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
block_device_mappings {
|
||||
device_name = "/dev/sdc"
|
||||
virtual_name = "ephemeral0"
|
||||
}
|
||||
iam_instance_profile = aws_iam_instance_profile.masters-externalpolicies-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-externalpolicies-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.masters-externalpolicies-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-externalpolicies-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "master-us-test-1a.masters.externalpolicies.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.masters-externalpolicies-example-com.id]
|
||||
}
|
||||
security_groups = [aws_security_group.masters-externalpolicies-example-com.id]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_master-us-test-1a.masters.externalpolicies.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "externalpolicies.example.com"
|
||||
"Name" = "master-us-test-1a.masters.externalpolicies.example.com"
|
||||
"Owner" = "John Doe"
|
||||
"foo/bar" = "fib+baz"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/externalpolicies.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "externalpolicies.example.com"
|
||||
"Name" = "master-us-test-1a.masters.externalpolicies.example.com"
|
||||
"Owner" = "John Doe"
|
||||
"foo/bar" = "fib+baz"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/externalpolicies.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_master-us-test-1a.masters.externalpolicies.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "nodes-externalpolicies-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = true
|
||||
iam_instance_profile = aws_iam_instance_profile.nodes-externalpolicies-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t2.medium"
|
||||
key_name = aws_key_pair.kubernetes-externalpolicies-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
resource "aws_launch_template" "nodes-externalpolicies-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 128
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.nodes-externalpolicies-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t2.medium"
|
||||
key_name = aws_key_pair.kubernetes-externalpolicies-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "nodes.externalpolicies.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 128
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.nodes-externalpolicies-example-com.id, "sg-exampleid3", "sg-exampleid4"]
|
||||
}
|
||||
security_groups = [aws_security_group.nodes-externalpolicies-example-com.id, "sg-exampleid3", "sg-exampleid4"]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_nodes.externalpolicies.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "externalpolicies.example.com"
|
||||
"Name" = "nodes.externalpolicies.example.com"
|
||||
"Owner" = "John Doe"
|
||||
"foo/bar" = "fib+baz"
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/externalpolicies.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "externalpolicies.example.com"
|
||||
"Name" = "nodes.externalpolicies.example.com"
|
||||
"Owner" = "John Doe"
|
||||
"foo/bar" = "fib+baz"
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/externalpolicies.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_nodes.externalpolicies.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_route53_record" "api-externalpolicies-example-com" {
|
||||
|
|
|
|||
|
|
@ -1,302 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
encryptionConfig: null
|
||||
etcdClusters:
|
||||
events:
|
||||
version: 3.3.10
|
||||
main:
|
||||
version: 3.3.10
|
||||
kubeAPIServer:
|
||||
allowPrivileged: true
|
||||
anonymousAuth: false
|
||||
apiServerCount: 3
|
||||
authorizationMode: AlwaysAllow
|
||||
bindAddress: 0.0.0.0
|
||||
cloudProvider: aws
|
||||
enableAdmissionPlugins:
|
||||
- NamespaceLifecycle
|
||||
- LimitRanger
|
||||
- ServiceAccount
|
||||
- PersistentVolumeLabel
|
||||
- DefaultStorageClass
|
||||
- DefaultTolerationSeconds
|
||||
- MutatingAdmissionWebhook
|
||||
- ValidatingAdmissionWebhook
|
||||
- NodeRestriction
|
||||
- ResourceQuota
|
||||
etcdServers:
|
||||
- http://127.0.0.1:4001
|
||||
etcdServersOverrides:
|
||||
- /events#http://127.0.0.1:4002
|
||||
image: k8s.gcr.io/kube-apiserver:v1.14.0
|
||||
insecureBindAddress: 127.0.0.1
|
||||
insecurePort: 8080
|
||||
kubeletPreferredAddressTypes:
|
||||
- InternalIP
|
||||
- Hostname
|
||||
- ExternalIP
|
||||
logLevel: 2
|
||||
requestheaderAllowedNames:
|
||||
- aggregator
|
||||
requestheaderExtraHeaderPrefixes:
|
||||
- X-Remote-Extra-
|
||||
requestheaderGroupHeaders:
|
||||
- X-Remote-Group
|
||||
requestheaderUsernameHeaders:
|
||||
- X-Remote-User
|
||||
securePort: 443
|
||||
serviceClusterIPRange: 100.64.0.0/13
|
||||
storageBackend: etcd3
|
||||
kubeControllerManager:
|
||||
allocateNodeCIDRs: true
|
||||
attachDetachReconcileSyncPeriod: 1m0s
|
||||
cloudProvider: aws
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
clusterName: ha.example.com
|
||||
configureCloudRoutes: true
|
||||
image: k8s.gcr.io/kube-controller-manager:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
useServiceAccountCredentials: true
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubeScheduler:
|
||||
image: k8s.gcr.io/kube-scheduler:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
masterKubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
registerSchedulable: false
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: ha.example.com
|
||||
ConfigBase: memfs://tests/ha.example.com
|
||||
InstanceGroupName: master-us-test-1a
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://tests/ha.example.com/addons/bootstrap-channel.yaml
|
||||
etcdManifests:
|
||||
- memfs://tests/ha.example.com/manifests/etcd/main.yaml
|
||||
- memfs://tests/ha.example.com/manifests/etcd/events.yaml
|
||||
protokubeImage:
|
||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
||||
name: protokube:1.15.0
|
||||
sources:
|
||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
||||
- https://github.com/kubernetes/kops/releases/download/v1.15.0/images-protokube.tar.gz
|
||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
|
|
@ -1,302 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
encryptionConfig: null
|
||||
etcdClusters:
|
||||
events:
|
||||
version: 3.3.10
|
||||
main:
|
||||
version: 3.3.10
|
||||
kubeAPIServer:
|
||||
allowPrivileged: true
|
||||
anonymousAuth: false
|
||||
apiServerCount: 3
|
||||
authorizationMode: AlwaysAllow
|
||||
bindAddress: 0.0.0.0
|
||||
cloudProvider: aws
|
||||
enableAdmissionPlugins:
|
||||
- NamespaceLifecycle
|
||||
- LimitRanger
|
||||
- ServiceAccount
|
||||
- PersistentVolumeLabel
|
||||
- DefaultStorageClass
|
||||
- DefaultTolerationSeconds
|
||||
- MutatingAdmissionWebhook
|
||||
- ValidatingAdmissionWebhook
|
||||
- NodeRestriction
|
||||
- ResourceQuota
|
||||
etcdServers:
|
||||
- http://127.0.0.1:4001
|
||||
etcdServersOverrides:
|
||||
- /events#http://127.0.0.1:4002
|
||||
image: k8s.gcr.io/kube-apiserver:v1.14.0
|
||||
insecureBindAddress: 127.0.0.1
|
||||
insecurePort: 8080
|
||||
kubeletPreferredAddressTypes:
|
||||
- InternalIP
|
||||
- Hostname
|
||||
- ExternalIP
|
||||
logLevel: 2
|
||||
requestheaderAllowedNames:
|
||||
- aggregator
|
||||
requestheaderExtraHeaderPrefixes:
|
||||
- X-Remote-Extra-
|
||||
requestheaderGroupHeaders:
|
||||
- X-Remote-Group
|
||||
requestheaderUsernameHeaders:
|
||||
- X-Remote-User
|
||||
securePort: 443
|
||||
serviceClusterIPRange: 100.64.0.0/13
|
||||
storageBackend: etcd3
|
||||
kubeControllerManager:
|
||||
allocateNodeCIDRs: true
|
||||
attachDetachReconcileSyncPeriod: 1m0s
|
||||
cloudProvider: aws
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
clusterName: ha.example.com
|
||||
configureCloudRoutes: true
|
||||
image: k8s.gcr.io/kube-controller-manager:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
useServiceAccountCredentials: true
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubeScheduler:
|
||||
image: k8s.gcr.io/kube-scheduler:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
masterKubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
registerSchedulable: false
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: ha.example.com
|
||||
ConfigBase: memfs://tests/ha.example.com
|
||||
InstanceGroupName: master-us-test-1b
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://tests/ha.example.com/addons/bootstrap-channel.yaml
|
||||
etcdManifests:
|
||||
- memfs://tests/ha.example.com/manifests/etcd/main.yaml
|
||||
- memfs://tests/ha.example.com/manifests/etcd/events.yaml
|
||||
protokubeImage:
|
||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
||||
name: protokube:1.15.0
|
||||
sources:
|
||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
||||
- https://github.com/kubernetes/kops/releases/download/v1.15.0/images-protokube.tar.gz
|
||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
|
|
@ -1,302 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
encryptionConfig: null
|
||||
etcdClusters:
|
||||
events:
|
||||
version: 3.3.10
|
||||
main:
|
||||
version: 3.3.10
|
||||
kubeAPIServer:
|
||||
allowPrivileged: true
|
||||
anonymousAuth: false
|
||||
apiServerCount: 3
|
||||
authorizationMode: AlwaysAllow
|
||||
bindAddress: 0.0.0.0
|
||||
cloudProvider: aws
|
||||
enableAdmissionPlugins:
|
||||
- NamespaceLifecycle
|
||||
- LimitRanger
|
||||
- ServiceAccount
|
||||
- PersistentVolumeLabel
|
||||
- DefaultStorageClass
|
||||
- DefaultTolerationSeconds
|
||||
- MutatingAdmissionWebhook
|
||||
- ValidatingAdmissionWebhook
|
||||
- NodeRestriction
|
||||
- ResourceQuota
|
||||
etcdServers:
|
||||
- http://127.0.0.1:4001
|
||||
etcdServersOverrides:
|
||||
- /events#http://127.0.0.1:4002
|
||||
image: k8s.gcr.io/kube-apiserver:v1.14.0
|
||||
insecureBindAddress: 127.0.0.1
|
||||
insecurePort: 8080
|
||||
kubeletPreferredAddressTypes:
|
||||
- InternalIP
|
||||
- Hostname
|
||||
- ExternalIP
|
||||
logLevel: 2
|
||||
requestheaderAllowedNames:
|
||||
- aggregator
|
||||
requestheaderExtraHeaderPrefixes:
|
||||
- X-Remote-Extra-
|
||||
requestheaderGroupHeaders:
|
||||
- X-Remote-Group
|
||||
requestheaderUsernameHeaders:
|
||||
- X-Remote-User
|
||||
securePort: 443
|
||||
serviceClusterIPRange: 100.64.0.0/13
|
||||
storageBackend: etcd3
|
||||
kubeControllerManager:
|
||||
allocateNodeCIDRs: true
|
||||
attachDetachReconcileSyncPeriod: 1m0s
|
||||
cloudProvider: aws
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
clusterName: ha.example.com
|
||||
configureCloudRoutes: true
|
||||
image: k8s.gcr.io/kube-controller-manager:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
useServiceAccountCredentials: true
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubeScheduler:
|
||||
image: k8s.gcr.io/kube-scheduler:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
masterKubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
registerSchedulable: false
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: ha.example.com
|
||||
ConfigBase: memfs://tests/ha.example.com
|
||||
InstanceGroupName: master-us-test-1c
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://tests/ha.example.com/addons/bootstrap-channel.yaml
|
||||
etcdManifests:
|
||||
- memfs://tests/ha.example.com/manifests/etcd/main.yaml
|
||||
- memfs://tests/ha.example.com/manifests/etcd/events.yaml
|
||||
protokubeImage:
|
||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
||||
name: protokube:1.15.0
|
||||
sources:
|
||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
||||
- https://github.com/kubernetes/kops/releases/download/v1.15.0/images-protokube.tar.gz
|
||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
|
|
@ -1,209 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: ha.example.com
|
||||
ConfigBase: memfs://tests/ha.example.com
|
||||
InstanceGroupName: nodes
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://tests/ha.example.com/addons/bootstrap-channel.yaml
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -91,12 +91,15 @@ provider "aws" {
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "master-us-test-1a-masters-ha-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.master-us-test-1a-masters-ha-example-com.id
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1a.masters.ha.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.master-us-test-1a-masters-ha-example-com.id
|
||||
version = aws_launch_template.master-us-test-1a-masters-ha-example-com.latest_version
|
||||
}
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1a.masters.ha.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -126,12 +129,15 @@ resource "aws_autoscaling_group" "master-us-test-1a-masters-ha-example-com" {
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "master-us-test-1b-masters-ha-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.master-us-test-1b-masters-ha-example-com.id
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1b.masters.ha.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.master-us-test-1b-masters-ha-example-com.id
|
||||
version = aws_launch_template.master-us-test-1b-masters-ha-example-com.latest_version
|
||||
}
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1b.masters.ha.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -161,12 +167,15 @@ resource "aws_autoscaling_group" "master-us-test-1b-masters-ha-example-com" {
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "master-us-test-1c-masters-ha-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.master-us-test-1c-masters-ha-example-com.id
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1c.masters.ha.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.master-us-test-1c-masters-ha-example-com.id
|
||||
version = aws_launch_template.master-us-test-1c-masters-ha-example-com.latest_version
|
||||
}
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1c.masters.ha.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -196,12 +205,15 @@ resource "aws_autoscaling_group" "master-us-test-1c-masters-ha-example-com" {
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "nodes-ha-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.nodes-ha-example-com.id
|
||||
max_size = 2
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 2
|
||||
name = "nodes.ha.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.nodes-ha-example-com.id
|
||||
version = aws_launch_template.nodes-ha-example-com.latest_version
|
||||
}
|
||||
max_size = 2
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 2
|
||||
name = "nodes.ha.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -360,96 +372,204 @@ resource "aws_key_pair" "kubernetes-ha-example-com-c4a6ed9aa889b9e2c39cd663eb9c7
|
|||
public_key = file("${path.module}/data/aws_key_pair_kubernetes.ha.example.com-c4a6ed9aa889b9e2c39cd663eb9c7157_public_key")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "master-us-test-1a-masters-ha-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
ephemeral_block_device {
|
||||
resource "aws_launch_template" "master-us-test-1a-masters-ha-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
block_device_mappings {
|
||||
device_name = "/dev/sdc"
|
||||
virtual_name = "ephemeral0"
|
||||
}
|
||||
iam_instance_profile = aws_iam_instance_profile.masters-ha-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-ha-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.masters-ha-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-ha-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "master-us-test-1a.masters.ha.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.masters-ha-example-com.id]
|
||||
}
|
||||
security_groups = [aws_security_group.masters-ha-example-com.id]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_master-us-test-1a.masters.ha.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "ha.example.com"
|
||||
"Name" = "master-us-test-1a.masters.ha.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/ha.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "ha.example.com"
|
||||
"Name" = "master-us-test-1a.masters.ha.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/ha.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_master-us-test-1a.masters.ha.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "master-us-test-1b-masters-ha-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
ephemeral_block_device {
|
||||
resource "aws_launch_template" "master-us-test-1b-masters-ha-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
block_device_mappings {
|
||||
device_name = "/dev/sdc"
|
||||
virtual_name = "ephemeral0"
|
||||
}
|
||||
iam_instance_profile = aws_iam_instance_profile.masters-ha-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-ha-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.masters-ha-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-ha-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "master-us-test-1b.masters.ha.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.masters-ha-example-com.id]
|
||||
}
|
||||
security_groups = [aws_security_group.masters-ha-example-com.id]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_master-us-test-1b.masters.ha.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "ha.example.com"
|
||||
"Name" = "master-us-test-1b.masters.ha.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1b"
|
||||
"kubernetes.io/cluster/ha.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "ha.example.com"
|
||||
"Name" = "master-us-test-1b.masters.ha.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1b"
|
||||
"kubernetes.io/cluster/ha.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_master-us-test-1b.masters.ha.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "master-us-test-1c-masters-ha-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
ephemeral_block_device {
|
||||
resource "aws_launch_template" "master-us-test-1c-masters-ha-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
block_device_mappings {
|
||||
device_name = "/dev/sdc"
|
||||
virtual_name = "ephemeral0"
|
||||
}
|
||||
iam_instance_profile = aws_iam_instance_profile.masters-ha-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-ha-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.masters-ha-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-ha-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "master-us-test-1c.masters.ha.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.masters-ha-example-com.id]
|
||||
}
|
||||
security_groups = [aws_security_group.masters-ha-example-com.id]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_master-us-test-1c.masters.ha.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "ha.example.com"
|
||||
"Name" = "master-us-test-1c.masters.ha.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1c"
|
||||
"kubernetes.io/cluster/ha.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "ha.example.com"
|
||||
"Name" = "master-us-test-1c.masters.ha.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1c"
|
||||
"kubernetes.io/cluster/ha.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_master-us-test-1c.masters.ha.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "nodes-ha-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
iam_instance_profile = aws_iam_instance_profile.nodes-ha-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t2.medium"
|
||||
key_name = aws_key_pair.kubernetes-ha-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
resource "aws_launch_template" "nodes-ha-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 128
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.nodes-ha-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t2.medium"
|
||||
key_name = aws_key_pair.kubernetes-ha-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "nodes.ha.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 128
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.nodes-ha-example-com.id]
|
||||
}
|
||||
security_groups = [aws_security_group.nodes-ha-example-com.id]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_nodes.ha.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "ha.example.com"
|
||||
"Name" = "nodes.ha.example.com"
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/ha.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "ha.example.com"
|
||||
"Name" = "nodes.ha.example.com"
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/ha.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_nodes.ha.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_route_table_association" "us-test-1a-ha-example-com" {
|
||||
|
|
|
|||
|
|
@ -4,16 +4,8 @@
|
|||
"Type": "AWS::AutoScaling::AutoScalingGroup",
|
||||
"Properties": {
|
||||
"AutoScalingGroupName": "master-us-test-1a.masters.launchtemplates.example.com",
|
||||
"LaunchTemplate": {
|
||||
"LaunchTemplateId": {
|
||||
"Ref": "AWSEC2LaunchTemplatemasterustest1amasterslaunchtemplatesexamplecom"
|
||||
},
|
||||
"Version": {
|
||||
"Fn::GetAtt": [
|
||||
"AWSEC2LaunchTemplatemasterustest1amasterslaunchtemplatesexamplecom",
|
||||
"LatestVersionNumber"
|
||||
]
|
||||
}
|
||||
"LaunchConfigurationName": {
|
||||
"Ref": "AWSAutoScalingLaunchConfigurationmasterustest1amasterslaunchtemplatesexamplecom"
|
||||
},
|
||||
"MaxSize": 1,
|
||||
"MinSize": 1,
|
||||
|
|
@ -70,16 +62,8 @@
|
|||
"Type": "AWS::AutoScaling::AutoScalingGroup",
|
||||
"Properties": {
|
||||
"AutoScalingGroupName": "master-us-test-1b.masters.launchtemplates.example.com",
|
||||
"LaunchTemplate": {
|
||||
"LaunchTemplateId": {
|
||||
"Ref": "AWSEC2LaunchTemplatemasterustest1bmasterslaunchtemplatesexamplecom"
|
||||
},
|
||||
"Version": {
|
||||
"Fn::GetAtt": [
|
||||
"AWSEC2LaunchTemplatemasterustest1bmasterslaunchtemplatesexamplecom",
|
||||
"LatestVersionNumber"
|
||||
]
|
||||
}
|
||||
"LaunchConfigurationName": {
|
||||
"Ref": "AWSAutoScalingLaunchConfigurationmasterustest1bmasterslaunchtemplatesexamplecom"
|
||||
},
|
||||
"MaxSize": 1,
|
||||
"MinSize": 1,
|
||||
|
|
@ -136,16 +120,8 @@
|
|||
"Type": "AWS::AutoScaling::AutoScalingGroup",
|
||||
"Properties": {
|
||||
"AutoScalingGroupName": "master-us-test-1c.masters.launchtemplates.example.com",
|
||||
"LaunchTemplate": {
|
||||
"LaunchTemplateId": {
|
||||
"Ref": "AWSEC2LaunchTemplatemasterustest1cmasterslaunchtemplatesexamplecom"
|
||||
},
|
||||
"Version": {
|
||||
"Fn::GetAtt": [
|
||||
"AWSEC2LaunchTemplatemasterustest1cmasterslaunchtemplatesexamplecom",
|
||||
"LatestVersionNumber"
|
||||
]
|
||||
}
|
||||
"LaunchConfigurationName": {
|
||||
"Ref": "AWSAutoScalingLaunchConfigurationmasterustest1cmasterslaunchtemplatesexamplecom"
|
||||
},
|
||||
"MaxSize": 1,
|
||||
"MinSize": 1,
|
||||
|
|
@ -202,16 +178,8 @@
|
|||
"Type": "AWS::AutoScaling::AutoScalingGroup",
|
||||
"Properties": {
|
||||
"AutoScalingGroupName": "nodes.launchtemplates.example.com",
|
||||
"LaunchTemplate": {
|
||||
"LaunchTemplateId": {
|
||||
"Ref": "AWSEC2LaunchTemplatenodeslaunchtemplatesexamplecom"
|
||||
},
|
||||
"Version": {
|
||||
"Fn::GetAtt": [
|
||||
"AWSEC2LaunchTemplatenodeslaunchtemplatesexamplecom",
|
||||
"LatestVersionNumber"
|
||||
]
|
||||
}
|
||||
"LaunchConfigurationName": {
|
||||
"Ref": "AWSAutoScalingLaunchConfigurationnodeslaunchtemplatesexamplecom"
|
||||
},
|
||||
"MaxSize": 2,
|
||||
"MinSize": 2,
|
||||
|
|
@ -264,6 +232,123 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"AWSAutoScalingLaunchConfigurationmasterustest1amasterslaunchtemplatesexamplecom": {
|
||||
"Type": "AWS::AutoScaling::LaunchConfiguration",
|
||||
"Properties": {
|
||||
"AssociatePublicIpAddress": true,
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 64,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Ref": "AWSIAMInstanceProfilemasterslaunchtemplatesexamplecom"
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "t3.medium",
|
||||
"KeyName": "kubernetes.launchtemplates.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"SecurityGroups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupmasterslaunchtemplatesexamplecom"
|
||||
}
|
||||
],
|
||||
"UserData": "extracted",
|
||||
"InstanceMonitoring": false
|
||||
}
|
||||
},
|
||||
"AWSAutoScalingLaunchConfigurationmasterustest1bmasterslaunchtemplatesexamplecom": {
|
||||
"Type": "AWS::AutoScaling::LaunchConfiguration",
|
||||
"Properties": {
|
||||
"AssociatePublicIpAddress": true,
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 64,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Ref": "AWSIAMInstanceProfilemasterslaunchtemplatesexamplecom"
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "t3.medium",
|
||||
"KeyName": "kubernetes.launchtemplates.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"SecurityGroups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupmasterslaunchtemplatesexamplecom"
|
||||
}
|
||||
],
|
||||
"UserData": "extracted",
|
||||
"InstanceMonitoring": false
|
||||
}
|
||||
},
|
||||
"AWSAutoScalingLaunchConfigurationmasterustest1cmasterslaunchtemplatesexamplecom": {
|
||||
"Type": "AWS::AutoScaling::LaunchConfiguration",
|
||||
"Properties": {
|
||||
"AssociatePublicIpAddress": true,
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 64,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Ref": "AWSIAMInstanceProfilemasterslaunchtemplatesexamplecom"
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "t3.medium",
|
||||
"KeyName": "kubernetes.launchtemplates.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"SecurityGroups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupmasterslaunchtemplatesexamplecom"
|
||||
}
|
||||
],
|
||||
"UserData": "extracted",
|
||||
"InstanceMonitoring": false
|
||||
}
|
||||
},
|
||||
"AWSAutoScalingLaunchConfigurationnodeslaunchtemplatesexamplecom": {
|
||||
"Type": "AWS::AutoScaling::LaunchConfiguration",
|
||||
"Properties": {
|
||||
"AssociatePublicIpAddress": true,
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 128,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Ref": "AWSIAMInstanceProfilenodeslaunchtemplatesexamplecom"
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "t3.medium",
|
||||
"KeyName": "kubernetes.launchtemplates.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"SecurityGroups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupnodeslaunchtemplatesexamplecom"
|
||||
}
|
||||
],
|
||||
"SpotPrice": "0.1",
|
||||
"UserData": "extracted",
|
||||
"InstanceMonitoring": false
|
||||
}
|
||||
},
|
||||
"AWSEC2DHCPOptionslaunchtemplatesexamplecom": {
|
||||
"Type": "AWS::EC2::DHCPOptions",
|
||||
"Properties": {
|
||||
|
|
@ -306,378 +391,6 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"AWSEC2LaunchTemplatemasterustest1amasterslaunchtemplatesexamplecom": {
|
||||
"Type": "AWS::EC2::LaunchTemplate",
|
||||
"Properties": {
|
||||
"LaunchTemplateName": "master-us-test-1a.masters.launchtemplates.example.com",
|
||||
"LaunchTemplateData": {
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 64,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Name": {
|
||||
"Ref": "AWSIAMInstanceProfilemasterslaunchtemplatesexamplecom"
|
||||
}
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "t3.medium",
|
||||
"KeyName": "kubernetes.launchtemplates.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"NetworkInterfaces": [
|
||||
{
|
||||
"AssociatePublicIpAddress": true,
|
||||
"DeleteOnTermination": true,
|
||||
"DeviceIndex": 0,
|
||||
"Groups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupmasterslaunchtemplatesexamplecom"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"TagSpecifications": [
|
||||
{
|
||||
"ResourceType": "instance",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "launchtemplates.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "master-us-test-1a.masters.launchtemplates.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/master",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "master-us-test-1a"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/launchtemplates.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ResourceType": "volume",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "launchtemplates.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "master-us-test-1a.masters.launchtemplates.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/master",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "master-us-test-1a"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/launchtemplates.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"UserData": "extracted"
|
||||
}
|
||||
}
|
||||
},
|
||||
"AWSEC2LaunchTemplatemasterustest1bmasterslaunchtemplatesexamplecom": {
|
||||
"Type": "AWS::EC2::LaunchTemplate",
|
||||
"Properties": {
|
||||
"LaunchTemplateName": "master-us-test-1b.masters.launchtemplates.example.com",
|
||||
"LaunchTemplateData": {
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 64,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Name": {
|
||||
"Ref": "AWSIAMInstanceProfilemasterslaunchtemplatesexamplecom"
|
||||
}
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "t3.medium",
|
||||
"KeyName": "kubernetes.launchtemplates.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"NetworkInterfaces": [
|
||||
{
|
||||
"AssociatePublicIpAddress": true,
|
||||
"DeleteOnTermination": true,
|
||||
"DeviceIndex": 0,
|
||||
"Groups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupmasterslaunchtemplatesexamplecom"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"TagSpecifications": [
|
||||
{
|
||||
"ResourceType": "instance",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "launchtemplates.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "master-us-test-1b.masters.launchtemplates.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/master",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "master-us-test-1b"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/launchtemplates.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ResourceType": "volume",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "launchtemplates.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "master-us-test-1b.masters.launchtemplates.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/master",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "master-us-test-1b"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/launchtemplates.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"UserData": "extracted"
|
||||
}
|
||||
}
|
||||
},
|
||||
"AWSEC2LaunchTemplatemasterustest1cmasterslaunchtemplatesexamplecom": {
|
||||
"Type": "AWS::EC2::LaunchTemplate",
|
||||
"Properties": {
|
||||
"LaunchTemplateName": "master-us-test-1c.masters.launchtemplates.example.com",
|
||||
"LaunchTemplateData": {
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 64,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Name": {
|
||||
"Ref": "AWSIAMInstanceProfilemasterslaunchtemplatesexamplecom"
|
||||
}
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "t3.medium",
|
||||
"KeyName": "kubernetes.launchtemplates.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"NetworkInterfaces": [
|
||||
{
|
||||
"AssociatePublicIpAddress": true,
|
||||
"DeleteOnTermination": true,
|
||||
"DeviceIndex": 0,
|
||||
"Groups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupmasterslaunchtemplatesexamplecom"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"TagSpecifications": [
|
||||
{
|
||||
"ResourceType": "instance",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "launchtemplates.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "master-us-test-1c.masters.launchtemplates.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/master",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "master-us-test-1c"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/launchtemplates.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ResourceType": "volume",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "launchtemplates.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "master-us-test-1c.masters.launchtemplates.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/master",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "master-us-test-1c"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/launchtemplates.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"UserData": "extracted"
|
||||
}
|
||||
}
|
||||
},
|
||||
"AWSEC2LaunchTemplatenodeslaunchtemplatesexamplecom": {
|
||||
"Type": "AWS::EC2::LaunchTemplate",
|
||||
"Properties": {
|
||||
"LaunchTemplateName": "nodes.launchtemplates.example.com",
|
||||
"LaunchTemplateData": {
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 128,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Name": {
|
||||
"Ref": "AWSIAMInstanceProfilenodeslaunchtemplatesexamplecom"
|
||||
}
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "t3.medium",
|
||||
"KeyName": "kubernetes.launchtemplates.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"InstanceMarketOptions": {
|
||||
"MarketType": "spot",
|
||||
"SpotOptions": {
|
||||
"BlockDurationMinutes": 120,
|
||||
"InstanceInterruptionBehavior": "hibernate",
|
||||
"MaxPrice": "0.1"
|
||||
}
|
||||
},
|
||||
"NetworkInterfaces": [
|
||||
{
|
||||
"AssociatePublicIpAddress": true,
|
||||
"DeleteOnTermination": true,
|
||||
"DeviceIndex": 0,
|
||||
"Groups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupnodeslaunchtemplatesexamplecom"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"TagSpecifications": [
|
||||
{
|
||||
"ResourceType": "instance",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "launchtemplates.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "nodes.launchtemplates.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/node",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "nodes"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/launchtemplates.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ResourceType": "volume",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "launchtemplates.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "nodes.launchtemplates.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/node",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "nodes"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/launchtemplates.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"UserData": "extracted"
|
||||
}
|
||||
}
|
||||
},
|
||||
"AWSEC2Route00000": {
|
||||
"Type": "AWS::EC2::Route",
|
||||
"Properties": {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Resources.AWSEC2LaunchTemplatemasterustest1amasterslaunchtemplatesexamplecom.Properties.LaunchTemplateData.UserData: |
|
||||
Resources.AWSAutoScalingLaunchConfigurationmasterustest1amasterslaunchtemplatesexamplecom.Properties.UserData: |
|
||||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
|
|
@ -303,7 +303,7 @@ Resources.AWSEC2LaunchTemplatemasterustest1amasterslaunchtemplatesexamplecom.Pro
|
|||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
Resources.AWSEC2LaunchTemplatemasterustest1bmasterslaunchtemplatesexamplecom.Properties.LaunchTemplateData.UserData: |
|
||||
Resources.AWSAutoScalingLaunchConfigurationmasterustest1bmasterslaunchtemplatesexamplecom.Properties.UserData: |
|
||||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
|
|
@ -608,7 +608,7 @@ Resources.AWSEC2LaunchTemplatemasterustest1bmasterslaunchtemplatesexamplecom.Pro
|
|||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
Resources.AWSEC2LaunchTemplatemasterustest1cmasterslaunchtemplatesexamplecom.Properties.LaunchTemplateData.UserData: |
|
||||
Resources.AWSAutoScalingLaunchConfigurationmasterustest1cmasterslaunchtemplatesexamplecom.Properties.UserData: |
|
||||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
|
|
@ -913,7 +913,7 @@ Resources.AWSEC2LaunchTemplatemasterustest1cmasterslaunchtemplatesexamplecom.Pro
|
|||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
Resources.AWSEC2LaunchTemplatenodeslaunchtemplatesexamplecom.Properties.LaunchTemplateData.UserData: |
|
||||
Resources.AWSAutoScalingLaunchConfigurationnodeslaunchtemplatesexamplecom.Properties.UserData: |
|
||||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ kubeControllerManager:
|
|||
attachDetachReconcileSyncPeriod: 1m0s
|
||||
cloudProvider: aws
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
clusterName: mixedinstances.example.com
|
||||
clusterName: launchtemplates.example.com
|
||||
configureCloudRoutes: true
|
||||
image: k8s.gcr.io/kube-controller-manager:v1.12.9
|
||||
leaderElection:
|
||||
|
|
@ -279,17 +279,17 @@ Assets:
|
|||
- e914b17532c411cb7c0cc472131b61935fb66b31@https://storage.googleapis.com/kubernetes-release/release/v1.12.9/bin/linux/amd64/kubelet
|
||||
- aa3e93897a6999d6c7dedbc41793c90d41eeb000@https://storage.googleapis.com/kubernetes-release/release/v1.12.9/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: mixedinstances.example.com
|
||||
ConfigBase: memfs://clusters.example.com/mixedinstances.example.com
|
||||
ClusterName: launchtemplates.example.com
|
||||
ConfigBase: memfs://clusters.example.com/launchtemplates.example.com
|
||||
InstanceGroupName: master-us-test-1a
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/mixedinstances.example.com/addons/bootstrap-channel.yaml
|
||||
- memfs://clusters.example.com/launchtemplates.example.com/addons/bootstrap-channel.yaml
|
||||
etcdManifests:
|
||||
- memfs://clusters.example.com/mixedinstances.example.com/manifests/etcd/main.yaml
|
||||
- memfs://clusters.example.com/mixedinstances.example.com/manifests/etcd/events.yaml
|
||||
- memfs://clusters.example.com/launchtemplates.example.com/manifests/etcd/main.yaml
|
||||
- memfs://clusters.example.com/launchtemplates.example.com/manifests/etcd/events.yaml
|
||||
protokubeImage:
|
||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
||||
name: protokube:1.15.0
|
||||
|
|
@ -207,7 +207,7 @@ kubeControllerManager:
|
|||
attachDetachReconcileSyncPeriod: 1m0s
|
||||
cloudProvider: aws
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
clusterName: mixedinstances.example.com
|
||||
clusterName: launchtemplates.example.com
|
||||
configureCloudRoutes: true
|
||||
image: k8s.gcr.io/kube-controller-manager:v1.12.9
|
||||
leaderElection:
|
||||
|
|
@ -279,17 +279,17 @@ Assets:
|
|||
- e914b17532c411cb7c0cc472131b61935fb66b31@https://storage.googleapis.com/kubernetes-release/release/v1.12.9/bin/linux/amd64/kubelet
|
||||
- aa3e93897a6999d6c7dedbc41793c90d41eeb000@https://storage.googleapis.com/kubernetes-release/release/v1.12.9/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: mixedinstances.example.com
|
||||
ConfigBase: memfs://clusters.example.com/mixedinstances.example.com
|
||||
ClusterName: launchtemplates.example.com
|
||||
ConfigBase: memfs://clusters.example.com/launchtemplates.example.com
|
||||
InstanceGroupName: master-us-test-1b
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/mixedinstances.example.com/addons/bootstrap-channel.yaml
|
||||
- memfs://clusters.example.com/launchtemplates.example.com/addons/bootstrap-channel.yaml
|
||||
etcdManifests:
|
||||
- memfs://clusters.example.com/mixedinstances.example.com/manifests/etcd/main.yaml
|
||||
- memfs://clusters.example.com/mixedinstances.example.com/manifests/etcd/events.yaml
|
||||
- memfs://clusters.example.com/launchtemplates.example.com/manifests/etcd/main.yaml
|
||||
- memfs://clusters.example.com/launchtemplates.example.com/manifests/etcd/events.yaml
|
||||
protokubeImage:
|
||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
||||
name: protokube:1.15.0
|
||||
|
|
@ -207,7 +207,7 @@ kubeControllerManager:
|
|||
attachDetachReconcileSyncPeriod: 1m0s
|
||||
cloudProvider: aws
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
clusterName: mixedinstances.example.com
|
||||
clusterName: launchtemplates.example.com
|
||||
configureCloudRoutes: true
|
||||
image: k8s.gcr.io/kube-controller-manager:v1.12.9
|
||||
leaderElection:
|
||||
|
|
@ -279,17 +279,17 @@ Assets:
|
|||
- e914b17532c411cb7c0cc472131b61935fb66b31@https://storage.googleapis.com/kubernetes-release/release/v1.12.9/bin/linux/amd64/kubelet
|
||||
- aa3e93897a6999d6c7dedbc41793c90d41eeb000@https://storage.googleapis.com/kubernetes-release/release/v1.12.9/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: mixedinstances.example.com
|
||||
ConfigBase: memfs://clusters.example.com/mixedinstances.example.com
|
||||
ClusterName: launchtemplates.example.com
|
||||
ConfigBase: memfs://clusters.example.com/launchtemplates.example.com
|
||||
InstanceGroupName: master-us-test-1c
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/mixedinstances.example.com/addons/bootstrap-channel.yaml
|
||||
- memfs://clusters.example.com/launchtemplates.example.com/addons/bootstrap-channel.yaml
|
||||
etcdManifests:
|
||||
- memfs://clusters.example.com/mixedinstances.example.com/manifests/etcd/main.yaml
|
||||
- memfs://clusters.example.com/mixedinstances.example.com/manifests/etcd/events.yaml
|
||||
- memfs://clusters.example.com/launchtemplates.example.com/manifests/etcd/main.yaml
|
||||
- memfs://clusters.example.com/launchtemplates.example.com/manifests/etcd/events.yaml
|
||||
protokubeImage:
|
||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
||||
name: protokube:1.15.0
|
||||
|
|
@ -159,9 +159,10 @@ kubeProxy:
|
|||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
image: k8s.gcr.io/kube-proxy:v1.12.9
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
allowPrivileged: true
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
|
|
@ -191,17 +192,17 @@ __EOF_IG_SPEC
|
|||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- e914b17532c411cb7c0cc472131b61935fb66b31@https://storage.googleapis.com/kubernetes-release/release/v1.12.9/bin/linux/amd64/kubelet
|
||||
- aa3e93897a6999d6c7dedbc41793c90d41eeb000@https://storage.googleapis.com/kubernetes-release/release/v1.12.9/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: crosszone.example.com
|
||||
ConfigBase: memfs://clusters.example.com/crosszone.example.com
|
||||
ClusterName: launchtemplates.example.com
|
||||
ConfigBase: memfs://clusters.example.com/launchtemplates.example.com
|
||||
InstanceGroupName: nodes
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/crosszone.example.com/addons/bootstrap-channel.yaml
|
||||
- memfs://clusters.example.com/launchtemplates.example.com/addons/bootstrap-channel.yaml
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
|
|
@ -91,15 +91,12 @@ provider "aws" {
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "master-us-test-1a-masters-launchtemplates-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.master-us-test-1a-masters-launchtemplates-example-com.id
|
||||
version = aws_launch_template.master-us-test-1a-masters-launchtemplates-example-com.latest_version
|
||||
}
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1a.masters.launchtemplates.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.master-us-test-1a-masters-launchtemplates-example-com.id
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1a.masters.launchtemplates.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -129,15 +126,12 @@ resource "aws_autoscaling_group" "master-us-test-1a-masters-launchtemplates-exam
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "master-us-test-1b-masters-launchtemplates-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.master-us-test-1b-masters-launchtemplates-example-com.id
|
||||
version = aws_launch_template.master-us-test-1b-masters-launchtemplates-example-com.latest_version
|
||||
}
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1b.masters.launchtemplates.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.master-us-test-1b-masters-launchtemplates-example-com.id
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1b.masters.launchtemplates.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -167,15 +161,12 @@ resource "aws_autoscaling_group" "master-us-test-1b-masters-launchtemplates-exam
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "master-us-test-1c-masters-launchtemplates-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.master-us-test-1c-masters-launchtemplates-example-com.id
|
||||
version = aws_launch_template.master-us-test-1c-masters-launchtemplates-example-com.latest_version
|
||||
}
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1c.masters.launchtemplates.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.master-us-test-1c-masters-launchtemplates-example-com.id
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1c.masters.launchtemplates.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -205,11 +196,8 @@ resource "aws_autoscaling_group" "master-us-test-1c-masters-launchtemplates-exam
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "nodes-launchtemplates-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.nodes-launchtemplates-example-com.id
|
||||
version = aws_launch_template.nodes-launchtemplates-example-com.latest_version
|
||||
}
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.nodes-launchtemplates-example-com.id
|
||||
max_size = 2
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 2
|
||||
|
|
@ -373,200 +361,85 @@ resource "aws_key_pair" "kubernetes-launchtemplates-example-com-c4a6ed9aa889b9e2
|
|||
public_key = file("${path.module}/data/aws_key_pair_kubernetes.launchtemplates.example.com-c4a6ed9aa889b9e2c39cd663eb9c7157_public_key")
|
||||
}
|
||||
|
||||
resource "aws_launch_template" "master-us-test-1a-masters-launchtemplates-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.masters-launchtemplates-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t3.medium"
|
||||
key_name = aws_key_pair.kubernetes-launchtemplates-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
resource "aws_launch_configuration" "master-us-test-1a-masters-launchtemplates-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
iam_instance_profile = aws_iam_instance_profile.masters-launchtemplates-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t3.medium"
|
||||
key_name = aws_key_pair.kubernetes-launchtemplates-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "master-us-test-1a.masters.launchtemplates.example.com-"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.masters-launchtemplates-example-com.id]
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "launchtemplates.example.com"
|
||||
"Name" = "master-us-test-1a.masters.launchtemplates.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/launchtemplates.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "launchtemplates.example.com"
|
||||
"Name" = "master-us-test-1a.masters.launchtemplates.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/launchtemplates.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_master-us-test-1a.masters.launchtemplates.example.com_user_data")
|
||||
security_groups = [aws_security_group.masters-launchtemplates-example-com.id]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_master-us-test-1a.masters.launchtemplates.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_launch_template" "master-us-test-1b-masters-launchtemplates-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.masters-launchtemplates-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t3.medium"
|
||||
key_name = aws_key_pair.kubernetes-launchtemplates-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
resource "aws_launch_configuration" "master-us-test-1b-masters-launchtemplates-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
iam_instance_profile = aws_iam_instance_profile.masters-launchtemplates-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t3.medium"
|
||||
key_name = aws_key_pair.kubernetes-launchtemplates-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "master-us-test-1b.masters.launchtemplates.example.com-"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.masters-launchtemplates-example-com.id]
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "launchtemplates.example.com"
|
||||
"Name" = "master-us-test-1b.masters.launchtemplates.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1b"
|
||||
"kubernetes.io/cluster/launchtemplates.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "launchtemplates.example.com"
|
||||
"Name" = "master-us-test-1b.masters.launchtemplates.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1b"
|
||||
"kubernetes.io/cluster/launchtemplates.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_master-us-test-1b.masters.launchtemplates.example.com_user_data")
|
||||
security_groups = [aws_security_group.masters-launchtemplates-example-com.id]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_master-us-test-1b.masters.launchtemplates.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_launch_template" "master-us-test-1c-masters-launchtemplates-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.masters-launchtemplates-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t3.medium"
|
||||
key_name = aws_key_pair.kubernetes-launchtemplates-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
resource "aws_launch_configuration" "master-us-test-1c-masters-launchtemplates-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
iam_instance_profile = aws_iam_instance_profile.masters-launchtemplates-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t3.medium"
|
||||
key_name = aws_key_pair.kubernetes-launchtemplates-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "master-us-test-1c.masters.launchtemplates.example.com-"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.masters-launchtemplates-example-com.id]
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "launchtemplates.example.com"
|
||||
"Name" = "master-us-test-1c.masters.launchtemplates.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1c"
|
||||
"kubernetes.io/cluster/launchtemplates.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "launchtemplates.example.com"
|
||||
"Name" = "master-us-test-1c.masters.launchtemplates.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1c"
|
||||
"kubernetes.io/cluster/launchtemplates.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_master-us-test-1c.masters.launchtemplates.example.com_user_data")
|
||||
security_groups = [aws_security_group.masters-launchtemplates-example-com.id]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_master-us-test-1c.masters.launchtemplates.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_launch_template" "nodes-launchtemplates-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 128
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.nodes-launchtemplates-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_market_options {
|
||||
market_type = "spot"
|
||||
spot_options {
|
||||
block_duration_minutes = 120
|
||||
instance_interruption_behavior = "hibernate"
|
||||
max_price = "0.1"
|
||||
}
|
||||
}
|
||||
instance_type = "t3.medium"
|
||||
key_name = aws_key_pair.kubernetes-launchtemplates-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
resource "aws_launch_configuration" "nodes-launchtemplates-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
iam_instance_profile = aws_iam_instance_profile.nodes-launchtemplates-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t3.medium"
|
||||
key_name = aws_key_pair.kubernetes-launchtemplates-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "nodes.launchtemplates.example.com-"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.nodes-launchtemplates-example-com.id]
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 128
|
||||
volume_type = "gp2"
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "launchtemplates.example.com"
|
||||
"Name" = "nodes.launchtemplates.example.com"
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/launchtemplates.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "launchtemplates.example.com"
|
||||
"Name" = "nodes.launchtemplates.example.com"
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/launchtemplates.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_nodes.launchtemplates.example.com_user_data")
|
||||
security_groups = [aws_security_group.nodes-launchtemplates-example-com.id]
|
||||
spot_price = "0.1"
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_nodes.launchtemplates.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_route_table_association" "us-test-1a-launchtemplates-example-com" {
|
||||
|
|
|
|||
|
|
@ -4,8 +4,16 @@
|
|||
"Type": "AWS::AutoScaling::AutoScalingGroup",
|
||||
"Properties": {
|
||||
"AutoScalingGroupName": "master-us-test-1a.masters.minimal.example.com",
|
||||
"LaunchConfigurationName": {
|
||||
"Ref": "AWSAutoScalingLaunchConfigurationmasterustest1amastersminimalexamplecom"
|
||||
"LaunchTemplate": {
|
||||
"LaunchTemplateId": {
|
||||
"Ref": "AWSEC2LaunchTemplatemasterustest1amastersminimalexamplecom"
|
||||
},
|
||||
"Version": {
|
||||
"Fn::GetAtt": [
|
||||
"AWSEC2LaunchTemplatemasterustest1amastersminimalexamplecom",
|
||||
"LatestVersionNumber"
|
||||
]
|
||||
}
|
||||
},
|
||||
"MaxSize": 1,
|
||||
"MinSize": 1,
|
||||
|
|
@ -62,8 +70,16 @@
|
|||
"Type": "AWS::AutoScaling::AutoScalingGroup",
|
||||
"Properties": {
|
||||
"AutoScalingGroupName": "nodes.minimal.example.com",
|
||||
"LaunchConfigurationName": {
|
||||
"Ref": "AWSAutoScalingLaunchConfigurationnodesminimalexamplecom"
|
||||
"LaunchTemplate": {
|
||||
"LaunchTemplateId": {
|
||||
"Ref": "AWSEC2LaunchTemplatenodesminimalexamplecom"
|
||||
},
|
||||
"Version": {
|
||||
"Fn::GetAtt": [
|
||||
"AWSEC2LaunchTemplatenodesminimalexamplecom",
|
||||
"LatestVersionNumber"
|
||||
]
|
||||
}
|
||||
},
|
||||
"MaxSize": 2,
|
||||
"MinSize": 2,
|
||||
|
|
@ -116,68 +132,6 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"AWSAutoScalingLaunchConfigurationmasterustest1amastersminimalexamplecom": {
|
||||
"Type": "AWS::AutoScaling::LaunchConfiguration",
|
||||
"Properties": {
|
||||
"AssociatePublicIpAddress": true,
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 64,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeviceName": "/dev/sdc",
|
||||
"VirtualName": "ephemeral0"
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Ref": "AWSIAMInstanceProfilemastersminimalexamplecom"
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "m3.medium",
|
||||
"KeyName": "kubernetes.minimal.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"SecurityGroups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupmastersminimalexamplecom"
|
||||
}
|
||||
],
|
||||
"UserData": "extracted",
|
||||
"InstanceMonitoring": false
|
||||
}
|
||||
},
|
||||
"AWSAutoScalingLaunchConfigurationnodesminimalexamplecom": {
|
||||
"Type": "AWS::AutoScaling::LaunchConfiguration",
|
||||
"Properties": {
|
||||
"AssociatePublicIpAddress": true,
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 128,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Ref": "AWSIAMInstanceProfilenodesminimalexamplecom"
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "t2.medium",
|
||||
"KeyName": "kubernetes.minimal.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"SecurityGroups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupnodesminimalexamplecom"
|
||||
}
|
||||
],
|
||||
"UserData": "extracted",
|
||||
"InstanceMonitoring": false
|
||||
}
|
||||
},
|
||||
"AWSEC2DHCPOptionsminimalexamplecom": {
|
||||
"Type": "AWS::EC2::DHCPOptions",
|
||||
"Properties": {
|
||||
|
|
@ -220,6 +174,192 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"AWSEC2LaunchTemplatemasterustest1amastersminimalexamplecom": {
|
||||
"Type": "AWS::EC2::LaunchTemplate",
|
||||
"Properties": {
|
||||
"LaunchTemplateName": "master-us-test-1a.masters.minimal.example.com",
|
||||
"LaunchTemplateData": {
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 64,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeviceName": "/dev/sdc",
|
||||
"VirtualName": "ephemeral0"
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Name": {
|
||||
"Ref": "AWSIAMInstanceProfilemastersminimalexamplecom"
|
||||
}
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "m3.medium",
|
||||
"KeyName": "kubernetes.minimal.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"NetworkInterfaces": [
|
||||
{
|
||||
"AssociatePublicIpAddress": true,
|
||||
"DeleteOnTermination": true,
|
||||
"DeviceIndex": 0,
|
||||
"Groups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupmastersminimalexamplecom"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"TagSpecifications": [
|
||||
{
|
||||
"ResourceType": "instance",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "minimal.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "master-us-test-1a.masters.minimal.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/master",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "master-us-test-1a"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/minimal.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ResourceType": "volume",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "minimal.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "master-us-test-1a.masters.minimal.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/master",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "master-us-test-1a"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/minimal.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"UserData": "extracted"
|
||||
}
|
||||
}
|
||||
},
|
||||
"AWSEC2LaunchTemplatenodesminimalexamplecom": {
|
||||
"Type": "AWS::EC2::LaunchTemplate",
|
||||
"Properties": {
|
||||
"LaunchTemplateName": "nodes.minimal.example.com",
|
||||
"LaunchTemplateData": {
|
||||
"BlockDeviceMappings": [
|
||||
{
|
||||
"DeviceName": "/dev/xvda",
|
||||
"Ebs": {
|
||||
"VolumeType": "gp2",
|
||||
"VolumeSize": 128,
|
||||
"DeleteOnTermination": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"IamInstanceProfile": {
|
||||
"Name": {
|
||||
"Ref": "AWSIAMInstanceProfilenodesminimalexamplecom"
|
||||
}
|
||||
},
|
||||
"ImageId": "ami-12345678",
|
||||
"InstanceType": "t2.medium",
|
||||
"KeyName": "kubernetes.minimal.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57",
|
||||
"NetworkInterfaces": [
|
||||
{
|
||||
"AssociatePublicIpAddress": true,
|
||||
"DeleteOnTermination": true,
|
||||
"DeviceIndex": 0,
|
||||
"Groups": [
|
||||
{
|
||||
"Ref": "AWSEC2SecurityGroupnodesminimalexamplecom"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"TagSpecifications": [
|
||||
{
|
||||
"ResourceType": "instance",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "minimal.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "nodes.minimal.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/node",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "nodes"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/minimal.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ResourceType": "volume",
|
||||
"Tags": [
|
||||
{
|
||||
"Key": "KubernetesCluster",
|
||||
"Value": "minimal.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "Name",
|
||||
"Value": "nodes.minimal.example.com"
|
||||
},
|
||||
{
|
||||
"Key": "k8s.io/role/node",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Key": "kops.k8s.io/instancegroup",
|
||||
"Value": "nodes"
|
||||
},
|
||||
{
|
||||
"Key": "kubernetes.io/cluster/minimal.example.com",
|
||||
"Value": "owned"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"UserData": "extracted"
|
||||
}
|
||||
}
|
||||
},
|
||||
"AWSEC2Route00000": {
|
||||
"Type": "AWS::EC2::Route",
|
||||
"Properties": {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Resources.AWSAutoScalingLaunchConfigurationmasterustest1amastersminimalexamplecom.Properties.UserData: |
|
||||
Resources.AWSEC2LaunchTemplatemasterustest1amastersminimalexamplecom.Properties.LaunchTemplateData.UserData: |
|
||||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
|
|
@ -301,7 +301,7 @@ Resources.AWSAutoScalingLaunchConfigurationmasterustest1amastersminimalexampleco
|
|||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
Resources.AWSAutoScalingLaunchConfigurationnodesminimalexamplecom.Properties.UserData: |
|
||||
Resources.AWSEC2LaunchTemplatenodesminimalexamplecom.Properties.LaunchTemplateData.UserData: |
|
||||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -1,302 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
encryptionConfig: null
|
||||
etcdClusters:
|
||||
events:
|
||||
version: 3.3.10
|
||||
main:
|
||||
version: 3.3.10
|
||||
kubeAPIServer:
|
||||
allowPrivileged: true
|
||||
anonymousAuth: false
|
||||
apiServerCount: 1
|
||||
authorizationMode: AlwaysAllow
|
||||
bindAddress: 0.0.0.0
|
||||
cloudProvider: aws
|
||||
enableAdmissionPlugins:
|
||||
- NamespaceLifecycle
|
||||
- LimitRanger
|
||||
- ServiceAccount
|
||||
- PersistentVolumeLabel
|
||||
- DefaultStorageClass
|
||||
- DefaultTolerationSeconds
|
||||
- MutatingAdmissionWebhook
|
||||
- ValidatingAdmissionWebhook
|
||||
- NodeRestriction
|
||||
- ResourceQuota
|
||||
etcdServers:
|
||||
- http://127.0.0.1:4001
|
||||
etcdServersOverrides:
|
||||
- /events#http://127.0.0.1:4002
|
||||
image: k8s.gcr.io/kube-apiserver:v1.14.0
|
||||
insecureBindAddress: 127.0.0.1
|
||||
insecurePort: 8080
|
||||
kubeletPreferredAddressTypes:
|
||||
- InternalIP
|
||||
- Hostname
|
||||
- ExternalIP
|
||||
logLevel: 2
|
||||
requestheaderAllowedNames:
|
||||
- aggregator
|
||||
requestheaderExtraHeaderPrefixes:
|
||||
- X-Remote-Extra-
|
||||
requestheaderGroupHeaders:
|
||||
- X-Remote-Group
|
||||
requestheaderUsernameHeaders:
|
||||
- X-Remote-User
|
||||
securePort: 443
|
||||
serviceClusterIPRange: 100.64.0.0/13
|
||||
storageBackend: etcd3
|
||||
kubeControllerManager:
|
||||
allocateNodeCIDRs: true
|
||||
attachDetachReconcileSyncPeriod: 1m0s
|
||||
cloudProvider: aws
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
clusterName: minimal-json.example.com
|
||||
configureCloudRoutes: true
|
||||
image: k8s.gcr.io/kube-controller-manager:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
useServiceAccountCredentials: true
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubeScheduler:
|
||||
image: k8s.gcr.io/kube-scheduler:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
masterKubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
registerSchedulable: false
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: minimal-json.example.com
|
||||
ConfigBase: memfs://clusters.example.com/minimal-json.example.com
|
||||
InstanceGroupName: master-us-test-1a
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/minimal-json.example.com/addons/bootstrap-channel.yaml
|
||||
etcdManifests:
|
||||
- memfs://clusters.example.com/minimal-json.example.com/manifests/etcd/main.yaml
|
||||
- memfs://clusters.example.com/minimal-json.example.com/manifests/etcd/events.yaml
|
||||
protokubeImage:
|
||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
||||
name: protokube:1.15.0
|
||||
sources:
|
||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
||||
- https://github.com/kubernetes/kops/releases/download/v1.15.0/images-protokube.tar.gz
|
||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
|
|
@ -1,209 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: minimal-json.example.com
|
||||
ConfigBase: memfs://clusters.example.com/minimal-json.example.com
|
||||
InstanceGroupName: nodes
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/minimal-json.example.com/addons/bootstrap-channel.yaml
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -92,7 +92,10 @@
|
|||
"aws_autoscaling_group": {
|
||||
"master-us-test-1a-masters-minimal-json-example-com": {
|
||||
"name": "master-us-test-1a.masters.minimal-json.example.com",
|
||||
"launch_configuration": "${aws_launch_configuration.master-us-test-1a-masters-minimal-json-example-com.id}",
|
||||
"launch_template": {
|
||||
"id": "${aws_launch_template.master-us-test-1a-masters-minimal-json-example-com.id}",
|
||||
"version": "${aws_launch_template.master-us-test-1a-masters-minimal-json-example-com.latest_version}"
|
||||
},
|
||||
"max_size": 1,
|
||||
"min_size": 1,
|
||||
"vpc_zone_identifier": [
|
||||
|
|
@ -139,7 +142,10 @@
|
|||
},
|
||||
"nodes-minimal-json-example-com": {
|
||||
"name": "nodes.minimal-json.example.com",
|
||||
"launch_configuration": "${aws_launch_configuration.nodes-minimal-json-example-com.id}",
|
||||
"launch_template": {
|
||||
"id": "${aws_launch_template.nodes-minimal-json-example-com.id}",
|
||||
"version": "${aws_launch_template.nodes-minimal-json-example-com.latest_version}"
|
||||
},
|
||||
"max_size": 2,
|
||||
"min_size": 2,
|
||||
"vpc_zone_identifier": [
|
||||
|
|
@ -261,54 +267,126 @@
|
|||
"public_key": "${file(\"${path.module}/data/aws_key_pair_kubernetes.minimal-json.example.com-c4a6ed9aa889b9e2c39cd663eb9c7157_public_key\")}"
|
||||
}
|
||||
},
|
||||
"aws_launch_configuration": {
|
||||
"aws_launch_template": {
|
||||
"master-us-test-1a-masters-minimal-json-example-com": {
|
||||
"name_prefix": "master-us-test-1a.masters.minimal-json.example.com-",
|
||||
"image_id": "ami-12345678",
|
||||
"instance_type": "m3.medium",
|
||||
"key_name": "${aws_key_pair.kubernetes-minimal-json-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id}",
|
||||
"iam_instance_profile": "${aws_iam_instance_profile.masters-minimal-json-example-com.id}",
|
||||
"security_groups": [
|
||||
"${aws_security_group.masters-minimal-json-example-com.id}"
|
||||
],
|
||||
"associate_public_ip_address": true,
|
||||
"user_data": "${file(\"${path.module}/data/aws_launch_configuration_master-us-test-1a.masters.minimal-json.example.com_user_data\")}",
|
||||
"root_block_device": {
|
||||
"volume_type": "gp2",
|
||||
"volume_size": 64,
|
||||
"delete_on_termination": true
|
||||
"lifecycle": {
|
||||
"create_before_destroy": true
|
||||
},
|
||||
"ephemeral_block_device": [
|
||||
"block_device_mappings": [
|
||||
{
|
||||
"device_name": "/dev/xvda",
|
||||
"ebs": [
|
||||
{
|
||||
"volume_type": "gp2",
|
||||
"volume_size": 64,
|
||||
"delete_on_termination": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"device_name": "/dev/sdc",
|
||||
"virtual_name": "ephemeral0"
|
||||
}
|
||||
],
|
||||
"lifecycle": {
|
||||
"create_before_destroy": true
|
||||
},
|
||||
"enable_monitoring": false
|
||||
"iam_instance_profile": [
|
||||
{
|
||||
"name": "${aws_iam_instance_profile.masters-minimal-json-example-com.id}"
|
||||
}
|
||||
],
|
||||
"image_id": "ami-12345678",
|
||||
"instance_type": "m3.medium",
|
||||
"key_name": "${aws_key_pair.kubernetes-minimal-json-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id}",
|
||||
"network_interfaces": [
|
||||
{
|
||||
"associate_public_ip_address": true,
|
||||
"delete_on_termination": true,
|
||||
"security_groups": [
|
||||
"${aws_security_group.masters-minimal-json-example-com.id}"
|
||||
]
|
||||
}
|
||||
],
|
||||
"tag_specifications": [
|
||||
{
|
||||
"resource_type": "instance",
|
||||
"tags": {
|
||||
"KubernetesCluster": "minimal-json.example.com",
|
||||
"Name": "master-us-test-1a.masters.minimal-json.example.com",
|
||||
"k8s.io/role/master": "1",
|
||||
"kops.k8s.io/instancegroup": "master-us-test-1a",
|
||||
"kubernetes.io/cluster/minimal-json.example.com": "owned"
|
||||
}
|
||||
},
|
||||
{
|
||||
"resource_type": "volume",
|
||||
"tags": {
|
||||
"KubernetesCluster": "minimal-json.example.com",
|
||||
"Name": "master-us-test-1a.masters.minimal-json.example.com",
|
||||
"k8s.io/role/master": "1",
|
||||
"kops.k8s.io/instancegroup": "master-us-test-1a",
|
||||
"kubernetes.io/cluster/minimal-json.example.com": "owned"
|
||||
}
|
||||
}
|
||||
],
|
||||
"user_data": "${file(\"${path.module}/data/aws_launch_template_master-us-test-1a.masters.minimal-json.example.com_user_data\")}"
|
||||
},
|
||||
"nodes-minimal-json-example-com": {
|
||||
"name_prefix": "nodes.minimal-json.example.com-",
|
||||
"image_id": "ami-12345678",
|
||||
"instance_type": "t2.medium",
|
||||
"key_name": "${aws_key_pair.kubernetes-minimal-json-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id}",
|
||||
"iam_instance_profile": "${aws_iam_instance_profile.nodes-minimal-json-example-com.id}",
|
||||
"security_groups": [
|
||||
"${aws_security_group.nodes-minimal-json-example-com.id}"
|
||||
],
|
||||
"associate_public_ip_address": true,
|
||||
"user_data": "${file(\"${path.module}/data/aws_launch_configuration_nodes.minimal-json.example.com_user_data\")}",
|
||||
"root_block_device": {
|
||||
"volume_type": "gp2",
|
||||
"volume_size": 128,
|
||||
"delete_on_termination": true
|
||||
},
|
||||
"lifecycle": {
|
||||
"create_before_destroy": true
|
||||
},
|
||||
"enable_monitoring": false
|
||||
"block_device_mappings": [
|
||||
{
|
||||
"device_name": "/dev/xvda",
|
||||
"ebs": [
|
||||
{
|
||||
"volume_type": "gp2",
|
||||
"volume_size": 128,
|
||||
"delete_on_termination": true
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"iam_instance_profile": [
|
||||
{
|
||||
"name": "${aws_iam_instance_profile.nodes-minimal-json-example-com.id}"
|
||||
}
|
||||
],
|
||||
"image_id": "ami-12345678",
|
||||
"instance_type": "t2.medium",
|
||||
"key_name": "${aws_key_pair.kubernetes-minimal-json-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id}",
|
||||
"network_interfaces": [
|
||||
{
|
||||
"associate_public_ip_address": true,
|
||||
"delete_on_termination": true,
|
||||
"security_groups": [
|
||||
"${aws_security_group.nodes-minimal-json-example-com.id}"
|
||||
]
|
||||
}
|
||||
],
|
||||
"tag_specifications": [
|
||||
{
|
||||
"resource_type": "instance",
|
||||
"tags": {
|
||||
"KubernetesCluster": "minimal-json.example.com",
|
||||
"Name": "nodes.minimal-json.example.com",
|
||||
"k8s.io/role/node": "1",
|
||||
"kops.k8s.io/instancegroup": "nodes",
|
||||
"kubernetes.io/cluster/minimal-json.example.com": "owned"
|
||||
}
|
||||
},
|
||||
{
|
||||
"resource_type": "volume",
|
||||
"tags": {
|
||||
"KubernetesCluster": "minimal-json.example.com",
|
||||
"Name": "nodes.minimal-json.example.com",
|
||||
"k8s.io/role/node": "1",
|
||||
"kops.k8s.io/instancegroup": "nodes",
|
||||
"kubernetes.io/cluster/minimal-json.example.com": "owned"
|
||||
}
|
||||
}
|
||||
],
|
||||
"user_data": "${file(\"${path.module}/data/aws_launch_template_nodes.minimal-json.example.com_user_data\")}"
|
||||
}
|
||||
},
|
||||
"aws_route": {
|
||||
|
|
|
|||
|
|
@ -1,295 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
# TODO(zmerlynn): Now we REALLY have no excuse not to do the reboot
|
||||
# optimization.
|
||||
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
encryptionConfig: null
|
||||
etcdClusters:
|
||||
events:
|
||||
version: 3.3.10
|
||||
main:
|
||||
version: 3.3.10
|
||||
kubeAPIServer:
|
||||
allowPrivileged: true
|
||||
anonymousAuth: false
|
||||
apiServerCount: 1
|
||||
authorizationMode: AlwaysAllow
|
||||
bindAddress: 0.0.0.0
|
||||
cloudProvider: aws
|
||||
enableAdmissionPlugins:
|
||||
- NamespaceLifecycle
|
||||
- LimitRanger
|
||||
- ServiceAccount
|
||||
- PersistentVolumeLabel
|
||||
- DefaultStorageClass
|
||||
- DefaultTolerationSeconds
|
||||
- MutatingAdmissionWebhook
|
||||
- ValidatingAdmissionWebhook
|
||||
- NodeRestriction
|
||||
- ResourceQuota
|
||||
etcdServers:
|
||||
- http://127.0.0.1:4001
|
||||
etcdServersOverrides:
|
||||
- /events#http://127.0.0.1:4002
|
||||
image: k8s.gcr.io/kube-apiserver:v1.14.0
|
||||
insecureBindAddress: 127.0.0.1
|
||||
insecurePort: 8080
|
||||
kubeletPreferredAddressTypes:
|
||||
- InternalIP
|
||||
- Hostname
|
||||
- ExternalIP
|
||||
logLevel: 2
|
||||
requestheaderAllowedNames:
|
||||
- aggregator
|
||||
requestheaderExtraHeaderPrefixes:
|
||||
- X-Remote-Extra-
|
||||
requestheaderGroupHeaders:
|
||||
- X-Remote-Group
|
||||
requestheaderUsernameHeaders:
|
||||
- X-Remote-User
|
||||
securePort: 443
|
||||
serviceClusterIPRange: 100.64.0.0/13
|
||||
storageBackend: etcd3
|
||||
kubeControllerManager:
|
||||
allocateNodeCIDRs: true
|
||||
attachDetachReconcileSyncPeriod: 1m0s
|
||||
cloudProvider: aws
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
clusterName: minimal-json.example.com
|
||||
configureCloudRoutes: true
|
||||
image: k8s.gcr.io/kube-controller-manager:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
useServiceAccountCredentials: true
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubeScheduler:
|
||||
image: k8s.gcr.io/kube-scheduler:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause-amd64:3.0
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
masterKubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause-amd64:3.0
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
registerSchedulable: false
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
- 71b7bc444ba0a5f7cd7a36e91b594c1c3d13890e160d85e0dfde38c46a24e416@https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/utils.tar.gz,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-utils.tar.gz,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/utils.tar.gz
|
||||
ClusterName: minimal-json.example.com
|
||||
ConfigBase: memfs://clusters.example.com/minimal-json.example.com
|
||||
InstanceGroupName: master-us-test-1a
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/minimal-json.example.com/addons/bootstrap-channel.yaml
|
||||
etcdManifests:
|
||||
- memfs://clusters.example.com/minimal-json.example.com/manifests/etcd/main.yaml
|
||||
- memfs://clusters.example.com/minimal-json.example.com/manifests/etcd/events.yaml
|
||||
protokubeImage:
|
||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
||||
name: protokube:1.15.0
|
||||
sources:
|
||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
||||
- https://github.com/kubernetes/kops/releases/download/v1.15.0/images-protokube.tar.gz
|
||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
|
|
@ -1,302 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
encryptionConfig: null
|
||||
etcdClusters:
|
||||
events:
|
||||
version: 3.3.10
|
||||
main:
|
||||
version: 3.3.10
|
||||
kubeAPIServer:
|
||||
allowPrivileged: true
|
||||
anonymousAuth: false
|
||||
apiServerCount: 1
|
||||
authorizationMode: AlwaysAllow
|
||||
bindAddress: 0.0.0.0
|
||||
cloudProvider: aws
|
||||
enableAdmissionPlugins:
|
||||
- NamespaceLifecycle
|
||||
- LimitRanger
|
||||
- ServiceAccount
|
||||
- PersistentVolumeLabel
|
||||
- DefaultStorageClass
|
||||
- DefaultTolerationSeconds
|
||||
- MutatingAdmissionWebhook
|
||||
- ValidatingAdmissionWebhook
|
||||
- NodeRestriction
|
||||
- ResourceQuota
|
||||
etcdServers:
|
||||
- http://127.0.0.1:4001
|
||||
etcdServersOverrides:
|
||||
- /events#http://127.0.0.1:4002
|
||||
image: k8s.gcr.io/kube-apiserver:v1.14.0
|
||||
insecureBindAddress: 127.0.0.1
|
||||
insecurePort: 8080
|
||||
kubeletPreferredAddressTypes:
|
||||
- InternalIP
|
||||
- Hostname
|
||||
- ExternalIP
|
||||
logLevel: 2
|
||||
requestheaderAllowedNames:
|
||||
- aggregator
|
||||
requestheaderExtraHeaderPrefixes:
|
||||
- X-Remote-Extra-
|
||||
requestheaderGroupHeaders:
|
||||
- X-Remote-Group
|
||||
requestheaderUsernameHeaders:
|
||||
- X-Remote-User
|
||||
securePort: 443
|
||||
serviceClusterIPRange: 100.64.0.0/13
|
||||
storageBackend: etcd3
|
||||
kubeControllerManager:
|
||||
allocateNodeCIDRs: true
|
||||
attachDetachReconcileSyncPeriod: 1m0s
|
||||
cloudProvider: aws
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
clusterName: minimal-tf11.example.com
|
||||
configureCloudRoutes: true
|
||||
image: k8s.gcr.io/kube-controller-manager:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
useServiceAccountCredentials: true
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubeScheduler:
|
||||
image: k8s.gcr.io/kube-scheduler:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
masterKubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
registerSchedulable: false
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: minimal-tf11.example.com
|
||||
ConfigBase: memfs://clusters.example.com/minimal-tf11.example.com
|
||||
InstanceGroupName: master-us-test-1a
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/minimal-tf11.example.com/addons/bootstrap-channel.yaml
|
||||
etcdManifests:
|
||||
- memfs://clusters.example.com/minimal-tf11.example.com/manifests/etcd/main.yaml
|
||||
- memfs://clusters.example.com/minimal-tf11.example.com/manifests/etcd/events.yaml
|
||||
protokubeImage:
|
||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
||||
name: protokube:1.15.0
|
||||
sources:
|
||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
||||
- https://github.com/kubernetes/kops/releases/download/v1.15.0/images-protokube.tar.gz
|
||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
|
|
@ -1,202 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
# TODO(zmerlynn): Now we REALLY have no excuse not to do the reboot
|
||||
# optimization.
|
||||
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause-amd64:3.0
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
- 71b7bc444ba0a5f7cd7a36e91b594c1c3d13890e160d85e0dfde38c46a24e416@https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/utils.tar.gz,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-utils.tar.gz,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/utils.tar.gz
|
||||
ClusterName: minimal-json.example.com
|
||||
ConfigBase: memfs://clusters.example.com/minimal-json.example.com
|
||||
InstanceGroupName: nodes
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/minimal-json.example.com/addons/bootstrap-channel.yaml
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
|
|
@ -1,209 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: minimal-tf11.example.com
|
||||
ConfigBase: memfs://clusters.example.com/minimal-tf11.example.com
|
||||
InstanceGroupName: nodes
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/minimal-tf11.example.com/addons/bootstrap-channel.yaml
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -81,11 +81,16 @@ provider "aws" {
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "master-us-test-1a-masters-minimal-tf11-example-com" {
|
||||
name = "master-us-test-1a.masters.minimal-tf11.example.com"
|
||||
launch_configuration = "${aws_launch_configuration.master-us-test-1a-masters-minimal-tf11-example-com.id}"
|
||||
max_size = 1
|
||||
min_size = 1
|
||||
vpc_zone_identifier = ["${aws_subnet.us-test-1a-minimal-tf11-example-com.id}"]
|
||||
name = "master-us-test-1a.masters.minimal-tf11.example.com"
|
||||
|
||||
launch_template = {
|
||||
id = "${aws_launch_template.master-us-test-1a-masters-minimal-tf11-example-com.id}"
|
||||
version = "${aws_launch_template.master-us-test-1a-masters-minimal-tf11-example-com.latest_version}"
|
||||
}
|
||||
|
||||
max_size = 1
|
||||
min_size = 1
|
||||
vpc_zone_identifier = ["${aws_subnet.us-test-1a-minimal-tf11-example-com.id}"]
|
||||
|
||||
tag = {
|
||||
key = "KubernetesCluster"
|
||||
|
|
@ -122,11 +127,16 @@ resource "aws_autoscaling_group" "master-us-test-1a-masters-minimal-tf11-example
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "nodes-minimal-tf11-example-com" {
|
||||
name = "nodes.minimal-tf11.example.com"
|
||||
launch_configuration = "${aws_launch_configuration.nodes-minimal-tf11-example-com.id}"
|
||||
max_size = 2
|
||||
min_size = 2
|
||||
vpc_zone_identifier = ["${aws_subnet.us-test-1a-minimal-tf11-example-com.id}"]
|
||||
name = "nodes.minimal-tf11.example.com"
|
||||
|
||||
launch_template = {
|
||||
id = "${aws_launch_template.nodes-minimal-tf11-example-com.id}"
|
||||
version = "${aws_launch_template.nodes-minimal-tf11-example-com.latest_version}"
|
||||
}
|
||||
|
||||
max_size = 2
|
||||
min_size = 2
|
||||
vpc_zone_identifier = ["${aws_subnet.us-test-1a-minimal-tf11-example-com.id}"]
|
||||
|
||||
tag = {
|
||||
key = "KubernetesCluster"
|
||||
|
|
@ -239,55 +249,125 @@ resource "aws_key_pair" "kubernetes-minimal-tf11-example-com-c4a6ed9aa889b9e2c39
|
|||
public_key = "${file("${path.module}/data/aws_key_pair_kubernetes.minimal-tf11.example.com-c4a6ed9aa889b9e2c39cd663eb9c7157_public_key")}"
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "master-us-test-1a-masters-minimal-tf11-example-com" {
|
||||
name_prefix = "master-us-test-1a.masters.minimal-tf11.example.com-"
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = "${aws_key_pair.kubernetes-minimal-tf11-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id}"
|
||||
iam_instance_profile = "${aws_iam_instance_profile.masters-minimal-tf11-example-com.id}"
|
||||
security_groups = ["${aws_security_group.masters-minimal-tf11-example-com.id}"]
|
||||
associate_public_ip_address = true
|
||||
user_data = "${file("${path.module}/data/aws_launch_configuration_master-us-test-1a.masters.minimal-tf11.example.com_user_data")}"
|
||||
resource "aws_launch_template" "master-us-test-1a-masters-minimal-tf11-example-com" {
|
||||
name_prefix = "master-us-test-1a.masters.minimal-tf11.example.com-"
|
||||
|
||||
root_block_device = {
|
||||
volume_type = "gp2"
|
||||
volume_size = 64
|
||||
delete_on_termination = true
|
||||
lifecycle = {
|
||||
create_before_destroy = true
|
||||
}
|
||||
|
||||
ephemeral_block_device = {
|
||||
block_device_mappings = {
|
||||
device_name = "/dev/xvda"
|
||||
|
||||
ebs = {
|
||||
volume_type = "gp2"
|
||||
volume_size = 64
|
||||
delete_on_termination = true
|
||||
}
|
||||
}
|
||||
|
||||
block_device_mappings = {
|
||||
device_name = "/dev/sdc"
|
||||
virtual_name = "ephemeral0"
|
||||
}
|
||||
|
||||
lifecycle = {
|
||||
create_before_destroy = true
|
||||
iam_instance_profile = {
|
||||
name = "${aws_iam_instance_profile.masters-minimal-tf11-example-com.id}"
|
||||
}
|
||||
|
||||
enable_monitoring = false
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = "${aws_key_pair.kubernetes-minimal-tf11-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id}"
|
||||
|
||||
network_interfaces = {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = ["${aws_security_group.masters-minimal-tf11-example-com.id}"]
|
||||
}
|
||||
|
||||
tag_specifications = {
|
||||
resource_type = "instance"
|
||||
|
||||
tags = {
|
||||
KubernetesCluster = "minimal-tf11.example.com"
|
||||
Name = "master-us-test-1a.masters.minimal-tf11.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/minimal-tf11.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
|
||||
tag_specifications = {
|
||||
resource_type = "volume"
|
||||
|
||||
tags = {
|
||||
KubernetesCluster = "minimal-tf11.example.com"
|
||||
Name = "master-us-test-1a.masters.minimal-tf11.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/minimal-tf11.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
|
||||
user_data = "${file("${path.module}/data/aws_launch_template_master-us-test-1a.masters.minimal-tf11.example.com_user_data")}"
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "nodes-minimal-tf11-example-com" {
|
||||
name_prefix = "nodes.minimal-tf11.example.com-"
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t2.medium"
|
||||
key_name = "${aws_key_pair.kubernetes-minimal-tf11-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id}"
|
||||
iam_instance_profile = "${aws_iam_instance_profile.nodes-minimal-tf11-example-com.id}"
|
||||
security_groups = ["${aws_security_group.nodes-minimal-tf11-example-com.id}"]
|
||||
associate_public_ip_address = true
|
||||
user_data = "${file("${path.module}/data/aws_launch_configuration_nodes.minimal-tf11.example.com_user_data")}"
|
||||
|
||||
root_block_device = {
|
||||
volume_type = "gp2"
|
||||
volume_size = 128
|
||||
delete_on_termination = true
|
||||
}
|
||||
resource "aws_launch_template" "nodes-minimal-tf11-example-com" {
|
||||
name_prefix = "nodes.minimal-tf11.example.com-"
|
||||
|
||||
lifecycle = {
|
||||
create_before_destroy = true
|
||||
}
|
||||
|
||||
enable_monitoring = false
|
||||
block_device_mappings = {
|
||||
device_name = "/dev/xvda"
|
||||
|
||||
ebs = {
|
||||
volume_type = "gp2"
|
||||
volume_size = 128
|
||||
delete_on_termination = true
|
||||
}
|
||||
}
|
||||
|
||||
iam_instance_profile = {
|
||||
name = "${aws_iam_instance_profile.nodes-minimal-tf11-example-com.id}"
|
||||
}
|
||||
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t2.medium"
|
||||
key_name = "${aws_key_pair.kubernetes-minimal-tf11-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id}"
|
||||
|
||||
network_interfaces = {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = ["${aws_security_group.nodes-minimal-tf11-example-com.id}"]
|
||||
}
|
||||
|
||||
tag_specifications = {
|
||||
resource_type = "instance"
|
||||
|
||||
tags = {
|
||||
KubernetesCluster = "minimal-tf11.example.com"
|
||||
Name = "nodes.minimal-tf11.example.com"
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/minimal-tf11.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
|
||||
tag_specifications = {
|
||||
resource_type = "volume"
|
||||
|
||||
tags = {
|
||||
KubernetesCluster = "minimal-tf11.example.com"
|
||||
Name = "nodes.minimal-tf11.example.com"
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/minimal-tf11.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
|
||||
user_data = "${file("${path.module}/data/aws_launch_template_nodes.minimal-tf11.example.com_user_data")}"
|
||||
}
|
||||
|
||||
resource "aws_route" "route-0-0-0-0--0" {
|
||||
|
|
|
|||
|
|
@ -1,302 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
encryptionConfig: null
|
||||
etcdClusters:
|
||||
events:
|
||||
version: 3.3.10
|
||||
main:
|
||||
version: 3.3.10
|
||||
kubeAPIServer:
|
||||
allowPrivileged: true
|
||||
anonymousAuth: false
|
||||
apiServerCount: 1
|
||||
authorizationMode: AlwaysAllow
|
||||
bindAddress: 0.0.0.0
|
||||
cloudProvider: aws
|
||||
enableAdmissionPlugins:
|
||||
- NamespaceLifecycle
|
||||
- LimitRanger
|
||||
- ServiceAccount
|
||||
- PersistentVolumeLabel
|
||||
- DefaultStorageClass
|
||||
- DefaultTolerationSeconds
|
||||
- MutatingAdmissionWebhook
|
||||
- ValidatingAdmissionWebhook
|
||||
- NodeRestriction
|
||||
- ResourceQuota
|
||||
etcdServers:
|
||||
- http://127.0.0.1:4001
|
||||
etcdServersOverrides:
|
||||
- /events#http://127.0.0.1:4002
|
||||
image: k8s.gcr.io/kube-apiserver:v1.14.0
|
||||
insecureBindAddress: 127.0.0.1
|
||||
insecurePort: 8080
|
||||
kubeletPreferredAddressTypes:
|
||||
- InternalIP
|
||||
- Hostname
|
||||
- ExternalIP
|
||||
logLevel: 2
|
||||
requestheaderAllowedNames:
|
||||
- aggregator
|
||||
requestheaderExtraHeaderPrefixes:
|
||||
- X-Remote-Extra-
|
||||
requestheaderGroupHeaders:
|
||||
- X-Remote-Group
|
||||
requestheaderUsernameHeaders:
|
||||
- X-Remote-User
|
||||
securePort: 443
|
||||
serviceClusterIPRange: 100.64.0.0/13
|
||||
storageBackend: etcd3
|
||||
kubeControllerManager:
|
||||
allocateNodeCIDRs: true
|
||||
attachDetachReconcileSyncPeriod: 1m0s
|
||||
cloudProvider: aws
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
clusterName: minimal.example.com
|
||||
configureCloudRoutes: true
|
||||
image: k8s.gcr.io/kube-controller-manager:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
useServiceAccountCredentials: true
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubeScheduler:
|
||||
image: k8s.gcr.io/kube-scheduler:v1.14.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
masterKubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
registerSchedulable: false
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: minimal.example.com
|
||||
ConfigBase: memfs://clusters.example.com/minimal.example.com
|
||||
InstanceGroupName: master-us-test-1a
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/minimal.example.com/addons/bootstrap-channel.yaml
|
||||
etcdManifests:
|
||||
- memfs://clusters.example.com/minimal.example.com/manifests/etcd/main.yaml
|
||||
- memfs://clusters.example.com/minimal.example.com/manifests/etcd/events.yaml
|
||||
protokubeImage:
|
||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
||||
name: protokube:1.15.0
|
||||
sources:
|
||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
||||
- https://github.com/kubernetes/kops/releases/download/v1.15.0/images-protokube.tar.gz
|
||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
|
|
@ -1,209 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL=https://artifacts.k8s.io/binaries/kops/1.15.0/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.15.0/linux-amd64-nodeup,https://kubeupv2.s3.amazonaws.com/kops/1.15.0/linux/amd64/nodeup
|
||||
NODEUP_HASH=9604ef18267ad7b5cf4cebbf7ab64423cf5bb0342d169c608ac6376e6af26d81
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL}"
|
||||
NODEUP_HASH="${NODEUP_HASH}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
skipInstall: true
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: warn
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 18.06.3
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.14.0
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
featureGates:
|
||||
ExperimentalCriticalPodAnnotation: "true"
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
kubelet: null
|
||||
nodeLabels: null
|
||||
taints: null
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
- c3b736fd0f003765c12d99f2c995a8369e6241f4@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubelet
|
||||
- 7e3a3ea663153f900cbd52900a39c91fa9f334be@https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl
|
||||
- 52e9d2de8a5f927307d9397308735658ee44ab8d@https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.7.5.tgz
|
||||
ClusterName: minimal.example.com
|
||||
ConfigBase: memfs://clusters.example.com/minimal.example.com
|
||||
InstanceGroupName: nodes
|
||||
Tags:
|
||||
- _automatic_upgrades
|
||||
- _aws
|
||||
channels:
|
||||
- memfs://clusters.example.com/minimal.example.com/addons/bootstrap-channel.yaml
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -81,12 +81,15 @@ provider "aws" {
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "master-us-test-1a-masters-minimal-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.master-us-test-1a-masters-minimal-example-com.id
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1a.masters.minimal.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.master-us-test-1a-masters-minimal-example-com.id
|
||||
version = aws_launch_template.master-us-test-1a-masters-minimal-example-com.latest_version
|
||||
}
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1a.masters.minimal.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -116,12 +119,15 @@ resource "aws_autoscaling_group" "master-us-test-1a-masters-minimal-example-com"
|
|||
}
|
||||
|
||||
resource "aws_autoscaling_group" "nodes-minimal-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_configuration = aws_launch_configuration.nodes-minimal-example-com.id
|
||||
max_size = 2
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 2
|
||||
name = "nodes.minimal.example.com"
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.nodes-minimal-example-com.id
|
||||
version = aws_launch_template.nodes-minimal-example-com.latest_version
|
||||
}
|
||||
max_size = 2
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 2
|
||||
name = "nodes.minimal.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
|
|
@ -224,48 +230,102 @@ resource "aws_key_pair" "kubernetes-minimal-example-com-c4a6ed9aa889b9e2c39cd663
|
|||
public_key = file("${path.module}/data/aws_key_pair_kubernetes.minimal.example.com-c4a6ed9aa889b9e2c39cd663eb9c7157_public_key")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "master-us-test-1a-masters-minimal-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
ephemeral_block_device {
|
||||
resource "aws_launch_template" "master-us-test-1a-masters-minimal-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
block_device_mappings {
|
||||
device_name = "/dev/sdc"
|
||||
virtual_name = "ephemeral0"
|
||||
}
|
||||
iam_instance_profile = aws_iam_instance_profile.masters-minimal-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-minimal-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.masters-minimal-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-minimal-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "master-us-test-1a.masters.minimal.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 64
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.masters-minimal-example-com.id]
|
||||
}
|
||||
security_groups = [aws_security_group.masters-minimal-example-com.id]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_master-us-test-1a.masters.minimal.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "minimal.example.com"
|
||||
"Name" = "master-us-test-1a.masters.minimal.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/minimal.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "minimal.example.com"
|
||||
"Name" = "master-us-test-1a.masters.minimal.example.com"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/minimal.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_master-us-test-1a.masters.minimal.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_launch_configuration" "nodes-minimal-example-com" {
|
||||
associate_public_ip_address = true
|
||||
enable_monitoring = false
|
||||
iam_instance_profile = aws_iam_instance_profile.nodes-minimal-example-com.id
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t2.medium"
|
||||
key_name = aws_key_pair.kubernetes-minimal-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
resource "aws_launch_template" "nodes-minimal-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
volume_size = 128
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.nodes-minimal-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t2.medium"
|
||||
key_name = aws_key_pair.kubernetes-minimal-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
name_prefix = "nodes.minimal.example.com-"
|
||||
root_block_device {
|
||||
delete_on_termination = true
|
||||
volume_size = 128
|
||||
volume_type = "gp2"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.nodes-minimal-example-com.id]
|
||||
}
|
||||
security_groups = [aws_security_group.nodes-minimal-example-com.id]
|
||||
user_data = file("${path.module}/data/aws_launch_configuration_nodes.minimal.example.com_user_data")
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "minimal.example.com"
|
||||
"Name" = "nodes.minimal.example.com"
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/minimal.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "minimal.example.com"
|
||||
"Name" = "nodes.minimal.example.com"
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/minimal.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
user_data = file("${path.module}/data/aws_launch_template_nodes.minimal.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_route_table_association" "us-test-1a-minimal-example-com" {
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue