/kakao-mobility

Assignment

Primary LanguageShell

kakao-mobility


First of Assignment


Aside from RDB, S3, etc, I focused entirely on building a Kubernetes environment.


Public cloud used

AWS


Resources Required for Infrastructure Configuration

# IAM
# VPC
# Rout53
# ALB
# EKS

Infrastructure diagram

Alt text



Process


[Excute Environments]

# Terrafrom v1.0.1
# AWS Cli v1.18.69
# Kubernetes Client v1.21.2
# AWS-IAM-Authenticator v0.5.0

[Precondition]

1. Create AWS Account
2. Set MFA
3. Add user
4. Grant a role
5. Create AWS Access Key ID and Secret Access Key
6. AWS config settings
7. EKS environment setting with terraform(proceed from this part!!!)

[Excluded service]
The following services have been excluded due to cost.

# NAT-Gateway
# Rout53
# ALB
# EKS

[Description of terraform files]

# versions.tf
Specifies the required provider version and required Terraform version

# vpc.tf
Provisions a VPC, subnets and availability zones.

# security-groups.tf
Provisions the security groups used by the EKS cluster.

# outputs.tf
Defines the output configuration.

Terraform TEST

cd Assignment01

# Initialize Terraform workspace
terraform init

# Provision
terraform apply

# Clean up workspace
terraform destroy

Reference

A vagrant project with an ubuntu box with the tools needed to do DevOps

Setting up AWS EKS (Hosted Kubernetes)

Auto Deploymemnt of EKS Infrastructure on AWS with Terraform

Provision an EKS Cluster (AWS)

Amazon Elastic Kubernetes Service (Amazon EKS) Architecture Explained with Diagram

Terraform 0.13으로 테라폼 코드 업그레이드하기



Second of Assignment


I deploy a web container to a Kubernetes environment using "kind" in my local environment.


Process


[Excute Environments]

# Ubuntu 20.04.1 LTS
# Node v10.16.3
# NPM v7.6.0
# Docker v19.03.8
# Kubernetes Client v1.21.2
# Kind v0.8.1

1. Source TEST

cd Assignment02

# install package
npm install

# start to server
node index.js

# test
curl http://localhost:8080

2. Unit TEST

cd Assignment02


# Set up a local Kubernetes cluster
## 1. Grant execution permission
chmod +x scripts/kind-with-registry.sh

## 2. Run the cluster using the local registry
scripts/kind-with-registry.sh



# Create and upload docker images
# 1. Build image
docker build -t localhost:5000/assignment02:latest -f ./Dockerfile.prod .

# 2. Excute container(Options)
docker run -p 8080:8080 --name web-service localhost:5000/assignment02:latest

# 3. Upload image
docker push localhost:5000/assignment02:latest



# Deploy to Kubernetes
## 1. Deploy the nginx docker container and run ia as a process on the cluster
kubectl apply -f manifests/5_deploy_using_local_registry.yaml

## 2. Confirm the pod is running
kubectl get pods
kubectl logs "name of pods"

## 3. Expose the service
kubectl apply -f manifests/6_service_using_local_registry.yaml

## 4. Confirm the service is running
kubectl get services

## 5. set it in a browser(http://localhost)

## 6. Clean up new cluster
kind delete cluster --name mycluster

3. Build

# Grant execution permission
chmod +x scripts/build.sh

# excute
scripts/build.sh

4. Deploy

# Grant execution permission
chmod +x scripts/deploy.sh

# excute
scripts/deploy.sh

Reference

Tutorial: Deploy Your First Kubernetes Cluster

https://twofootdog.tistory.com/73

kind

Your Intro Guide to Kubernetes

AWS EKS에서 CodePipeline을 활용한 스프링부트 서비스 배포