Skip to content

neilkuan/k3s-lab-aws-cdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Install k3s Lab in AWS Spot EC2 via AWS CDK infra

Infra

# create infra
cd infra/
cdk deploy --require-approval never 

# connect k3s node
aws ssm start-session ${INSTANCE_ID}

aws cdk-spot-one

K3s Manual create cluster via k3d

# add /usr/local/bin/ to $PATH
export PATH=$PATH:/usr/local/bin/

# Download kubectl 
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"

chmod +x kubectl

mv kuebctl /usr/local/bin/


# install k3d 
curl -s https://raw.githubusercontent.com/rancher/k3d/main/install.sh | bash

# k3d create cluster named portainer
k3d cluster create portainer \
--api-port 6443 \
--servers 1 \
--agents 1 \
-p 30000-32767:30000-32767@server[0]

create k3s create k3s

# Create portainer
curl -LO https://raw.githubusercontent.com/portainer/portainer-k8s/master/portainer-nodeport.yaml | kubectl apply -f -

create portainer portainer console

List k3s node

k3d node list
NAME                     ROLE           CLUSTER     STATUS
k3d-portainer-agent-0    agent          portainer   running
k3d-portainer-server-0   server         portainer   running
k3d-portainer-serverlb   loadbalancer   portainer   running

k3d cluster delete portainer

k3d cluster delete

Delete Infra

cdk destroy -f 

delete cdk-spot-one

Usege:

Releases

No releases published

Packages

No packages published