Skip to content

Commit 21ea041

Browse files
committed
Add startup.sh & revise markdowns
1 parent a394f81 commit 21ea041

File tree

4 files changed

+80
-5
lines changed

4 files changed

+80
-5
lines changed

k8s/command.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Access pod
2+
3+
- 특정 pod bash에 접근
4+
5+
```bash
6+
kubectl exec --stdin --tty <pod name> -- /bin/bash
7+
```
8+
9+
- network util pod 생성 및 shell 로그인
10+
11+
```bash
12+
kubectl run <netutil name> --rm -i --tty --image praqma/network-multitool -- bash
13+
```
14+
15+
# Dashboard
16+
17+
- *관련 reference* : `https://kubernetes.io/ko/docs/tasks/access-application-cluster/web-ui-dashboard/`
18+
19+
- dashboard UI 배포
20+
21+
```bash
22+
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.4.0/aio/deploy/recommended.yaml
23+
```
24+
25+
- dashboard 접속 활성화
26+
27+
```bash
28+
kubectl proxy
29+
```
30+
31+
- dashboard URL (접근)
32+
33+
```
34+
http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
35+
```
36+
37+
- dashboard UI에 접근에 사용할 token 얻기
38+
39+
```bash
40+
kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | awk '/^deployment-controller-token-/{print $1}') | awk '$1=="token:"{print $2}'
41+
```
42+
43+
# 참고 : TODO
44+
45+
- dashboard에 service, ingress, node 등의 항목이 나타나지 않는데, 이를 해결

k8s/mongo.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,3 @@
5555
> rs.isMaster()
5656
> rs.stepDown()
5757
```
58-
59-
## 참고
60-
61-
- 특정 pod bash에 접근 : `kubectl exec --stdin --tty <pod name> -- /bin/bash`
62-
- network util pod 생성 및 shell 로그인 `kubectl run my-shell --rm -i --tty --image praqma/network-multitool -- bash`

k8s/readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- [ingress 테스트](#ingress-테스트)
1414
- [load balancer 테스트](#load-balancer-테스트)
1515
- [클러스터 삭제하기](#클러스터-삭제하기)
16+
1617
# Description
1718

1819
- **kind**가 무엇인지, 어떻게 사용하는지

k8s/startup.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/sh
2+
3+
Green='\033[0;32m' # Green
4+
NC='\033[0m' # No Color
5+
6+
echo "${Green}[startup] Creating k8s cluster...${NC}"
7+
kind create cluster --config ./kind-config.yaml
8+
9+
echo
10+
echo "${Green}[startup] Deploying NGINX ingress controller...${NC}"
11+
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
12+
13+
echo
14+
echo "${Green}[startup] Waiting for NGINX setting completion...${NC}"
15+
kubectl wait --namespace ingress-nginx \
16+
--for=condition=ready pod \
17+
--selector=app.kubernetes.io/component=controller \
18+
--timeout=90s
19+
20+
echo
21+
echo "${Green}[startup] Creating metallb load balancer namespace...${NC}"
22+
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.12.1/manifests/namespace.yaml
23+
24+
echo
25+
echo "${Green}[startup] Deploying metallb...${NC}"
26+
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.12.1/manifests/metallb.yaml
27+
28+
echo
29+
echo "${Green}[startup] Waiting for metallb setting completion...${NC}"
30+
#kubectl get pods -n metallb-system --watch
31+
kubectl wait --namespace metallb-system \
32+
--for=condition=ready pod \
33+
--selector=app=metallb,component=speaker \
34+
--timeout=90s

0 commit comments

Comments
 (0)