update
This commit is contained in:
3
ansible/ansible.cfg
Normal file
3
ansible/ansible.cfg
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[defaults]
|
||||||
|
host_key_checking=False
|
||||||
|
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
[host]
|
[host]
|
||||||
10.10.43.[100:101] ansible_user=root
|
10.10.43.[100:101] ansible_user=root
|
||||||
10.10.43.[110:147]
|
10.10.43.[110:153]
|
||||||
|
|||||||
27
kops/aws_kops_prod/instancegroup_backup/vector.yaml
Normal file
27
kops/aws_kops_prod/instancegroup_backup/vector.yaml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
apiVersion: kops.k8s.io/v1alpha2
|
||||||
|
kind: InstanceGroup
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
kops.k8s.io/cluster: k8s-prod.datasaker.io
|
||||||
|
name: vector
|
||||||
|
spec:
|
||||||
|
image: ami-01e58630c6fb43a44
|
||||||
|
instanceMetadata:
|
||||||
|
httpTokens: required
|
||||||
|
machineType: c6i.2xlarge
|
||||||
|
manager: CloudGroup
|
||||||
|
maxSize: 1
|
||||||
|
minSize: 1
|
||||||
|
mixedInstancesPolicy:
|
||||||
|
onDemandAboveBase: 0
|
||||||
|
onDemandBase: 0
|
||||||
|
spotAllocationStrategy: capacity-optimized
|
||||||
|
nodeLabels:
|
||||||
|
datasaker/group: vector
|
||||||
|
kops.k8s.io/instancegroup: vector
|
||||||
|
role: Node
|
||||||
|
rootVolumeSize: 100
|
||||||
|
subnets:
|
||||||
|
- ap-northeast-2c
|
||||||
|
taints:
|
||||||
|
- prod/vector:NoSchedule
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
filename="docker-ubuntu.pkr.hcl"
|
filename="docker-amazon.pkr.hcl"
|
||||||
|
|
||||||
echo "packer init ${filename}"
|
echo "packer init ${filename}"
|
||||||
echo "packer fmt ${filename}"
|
echo "packer fmt ${filename}"
|
||||||
|
|||||||
49
packer/build_ami_security/kube-amazon.pkr.hcl
Normal file
49
packer/build_ami_security/kube-amazon.pkr.hcl
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
packer {
|
||||||
|
required_plugins {
|
||||||
|
amazon = {
|
||||||
|
version = ">= 0.0.2"
|
||||||
|
source = "github.com/hashicorp/amazon"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "ami_prefix" {
|
||||||
|
type = string
|
||||||
|
default = "kubernetes-amazonlinux"
|
||||||
|
}
|
||||||
|
|
||||||
|
locals {
|
||||||
|
timestamp = regex_replace(timestamp(), "[- TZ:]", "")
|
||||||
|
}
|
||||||
|
|
||||||
|
# source 블록에는 실제 빌드할 이미지에 대한 스펙을 정의
|
||||||
|
source "amazon-ebs" "kubernetes-amazonlinux" {
|
||||||
|
ami_name = "${var.ami_prefix}-${local.timestamp}"
|
||||||
|
instance_type = "t3.small"
|
||||||
|
region = "ap-northeast-2"
|
||||||
|
source_ami_filter {
|
||||||
|
filters = {
|
||||||
|
image-id = "ami-0eb14fe5735c13eb5"
|
||||||
|
root-device-type = "ebs"
|
||||||
|
virtualization-type = "hvm"
|
||||||
|
}
|
||||||
|
most_recent = true
|
||||||
|
owners = ["137112412989"]
|
||||||
|
}
|
||||||
|
tags = {
|
||||||
|
source_ami_name = "{{ .SourceAMIName }}"
|
||||||
|
}
|
||||||
|
ssh_username = "ec2-user"
|
||||||
|
}
|
||||||
|
|
||||||
|
build {
|
||||||
|
name = "datasaker-packer"
|
||||||
|
sources = ["source.amazon-ebs.kubernetes-amazonlinux"]
|
||||||
|
|
||||||
|
provisioner "ansible" {
|
||||||
|
playbook_file = "../ansible/kubernetes_roles.yaml"
|
||||||
|
user = "ec2-user"
|
||||||
|
extra_arguments = ["--become"]
|
||||||
|
ansible_env_vars = ["ANSIBLE_HOST_KEY_CHECKING=False"]
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user