Mixed results.

This commit is contained in:
Sacha Ligthert 2022-11-14 23:24:05 +01:00
commit f395672414
2 changed files with 118 additions and 0 deletions

26
notes.txt Normal file
View File

@ -0,0 +1,26 @@
# Source: https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/
cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-\$basearch
enabled=1
gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
exclude=kubelet kubeadm kubectl
EOF
# Set SELinux in permissive mode (effectively disabling it)
sudo setenforce 0
sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
sudo yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
sudo systemctl enable --now kubelet
# Requirement
sudo yum install docker
sudo systemctl start docker
sudo systemctl enable docker
# controlplane
sudo kubeadm config images pull

92
terraform.tf Normal file
View File

@ -0,0 +1,92 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.0.0"
}
}
}
provider "aws" {
region = "eu-west-1"
}
resource "aws_security_group" "k8s" {
description = "Access all the K8S boxes"
name = "k8s-sg"
ingress {
description = "Allow from all of the Internets"
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
ipv6_cidr_blocks = ["::/0"]
}
egress {
description = "Allow to contact the Internet"
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
ipv6_cidr_blocks = ["::/0"]
}
}
resource "aws_instance" "controlplane" {
ami = "ami-0ee415e1b8b71305f"
associate_public_ip_address = true
instance_type = "t3.large"
key_name = "overseer.ligthert.net"
tags = {
Name = "controlplane"
}
root_block_device {
volume_size = "128"
volume_type = "gp2"
}
user_data = "yum update -y"
vpc_security_group_ids = [aws_security_group.k8s.id]
}
output "controlplane_public_ip" {
value = aws_instance.controlplane.public_ip
}
output "controlplane_private_ip" {
value = aws_instance.controlplane.private_ip
}
output "controlplane_instance_id" {
value = aws_instance.controlplane.arn
}
resource "aws_instance" "node" {
ami = "ami-0ee415e1b8b71305f"
associate_public_ip_address = true
instance_type = "t3.large"
key_name = "overseer.ligthert.net"
tags = {
Name = "node"
}
root_block_device {
volume_size = "128"
volume_type = "gp2"
}
user_data = "yum update -y"
vpc_security_group_ids = [aws_security_group.k8s.id]
}
output "node_public_ip" {
value = aws_instance.node.public_ip
}
output "node_private_ip" {
value = aws_instance.node.private_ip
}
output "node_instance_id" {
value = aws_instance.node.arn
}