Created
February 11, 2019 17:00
-
-
Save chuckha/32c4ae957905fdfeb6fe573b74fd3cc3 to your computer and use it in GitHub Desktop.
testing machine set
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Copyright 2018 The Kubernetes Authors. | |
# | |
# 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. | |
# Verifies that all source files contain the necessary copyright boilerplate | |
# snippet. | |
set -o xtrace | |
set -o errexit | |
set -o nounset | |
cleanup() { | |
source envfile | |
aws ec2 describe-instances --query "Reservations[*].Instances[*].[InstanceId]" | jq '.[][0][0]' --raw-output | xargs aws ec2 terminate-instances --instance-ids | |
} | |
kind create cluster --image kindest/node:latest | |
KUBECONFIG="$(kind get kubeconfig-path --name=1)" | |
clusterctl alpha phases apply-cluster-api-components -p ./cmd/clusterctl/examples/aws/out/provider-components.yaml --kubeconfig "${KUBECONFIG}" | |
cat <<EOF | kubectl apply --kubeconfig "${KUBECONFIG}" -f - | |
apiVersion: "cluster.k8s.io/v1alpha1" | |
kind: Cluster | |
metadata: | |
name: test1 | |
spec: | |
clusterNetwork: | |
services: | |
cidrBlocks: ["10.96.0.0/12"] | |
pods: | |
cidrBlocks: ["192.168.0.0/16"] | |
serviceDomain: "cluster.local" | |
providerSpec: | |
value: | |
apiVersion: "awsprovider/v1alpha1" | |
kind: "AWSClusterProviderSpec" | |
region: "us-west-2" | |
sshKeyName: "laptop" | |
EOF | |
read -p "once the infra is done is done push enter to continue setting up the control plane" | |
cat <<EOF | kubectl apply --kubeconfig "${KUBECONFIG}" -f - | |
apiVersion: "cluster.k8s.io/v1alpha1" | |
kind: Machine | |
metadata: | |
name: aws-controlplane-0 | |
labels: | |
set: controlplane | |
spec: | |
versions: | |
kubelet: v1.13.2 | |
controlPlane: v1.13.2 | |
providerSpec: | |
value: | |
apiVersion: awsprovider/v1alpha1 | |
kind: AWSMachineProviderSpec | |
instanceType: "t2.medium" | |
iamInstanceProfile: "control-plane.cluster-api-provider-aws.sigs.k8s.io" | |
keyName: "laptop" | |
EOF | |
read -p "once the control plane is provisioined push enter to set up the machine deployment" | |
cat <<EOF | kubectl apply --kubeconfig "${KUBECONFIG}" -f - | |
apiVersion: "cluster.k8s.io/v1alpha1" | |
kind: MachineSet | |
metadata: | |
name: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | |
spec: | |
replicas: 3 | |
selector: | |
matchLabels: | |
set: node | |
template: | |
metadata: | |
labels: | |
set: node | |
spec: | |
versions: | |
kubelet: v1.13.2 | |
providerSpec: | |
value: | |
apiVersion: awsprovider/v1alpha1 | |
kind: AWSMachineProviderSpec | |
instanceType: "t2.medium" | |
iamInstanceProfile: "nodes.cluster-api-provider-aws.sigs.k8s.io" | |
keyName: "laptop" | |
EOF | |
# MACHINE DEPLOYMENT TEST | |
# | |
# cat <<EOF | kubectl apply --kubeconfig "${KUBECONFIG}" -f - | |
# apiVersion: "cluster.k8s.io/v1alpha1" | |
# kind: MachineDeployment | |
# metadata: | |
# name: nodes | |
# spec: | |
# replicas: 1 | |
# selector: | |
# matchLabels: | |
# set: node | |
# template: | |
# metadata: | |
# labels: | |
# set: node | |
# spec: | |
# versions: | |
# kubelet: v1.13.0 | |
# providerSpec: | |
# value: | |
# apiVersion: awsprovider/v1alpha1 | |
# kind: AWSMachineProviderSpec | |
# instanceType: "t2.medium" | |
# iamInstanceProfile: "nodes.cluster-api-provider-aws.sigs.k8s.io" | |
# keyName: "laptop" | |
# EOF | |
read -p "press enter to clean up all instances" | |
cleanup | |
kind delete cluster 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment