Skip to content

Commit fbb533e

Browse files
committed
Update studies.md
1 parent aa9ea76 commit fbb533e

File tree

4 files changed

+138
-80
lines changed

4 files changed

+138
-80
lines changed

k8s/command.md

Lines changed: 0 additions & 79 deletions
This file was deleted.

k8s/startup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Green='\033[0;32m' # Green
44
NC='\033[0m' # No Color
55

66
echo "${Green}[startup] Creating k8s cluster...${NC}"
7-
kind create cluster --config ./kind-config.yaml
7+
kind create cluster --config ./statefulset-mongo-kind-config.yaml
88

99
echo
1010
echo "${Green}[startup] Deploying NGINX ingress controller...${NC}"

k8s/statefulset-mongo-kind-config.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@ kind: Cluster
33

44
nodes:
55
- role: control-plane # configuration for control-plane node
6+
kubeadmConfigPatches: # for using ingress
7+
- |
8+
kind: InitConfiguration
9+
nodeRegistration:
10+
kubeletExtraArgs:
11+
node-labels: "ingress-ready=true"
12+
extraPortMappings:
13+
- containerPort: 80 #for ingress based foo, bar service
14+
hostPort: 80
15+
protocol: TCP
16+
- containerPort: 31593 # for LoadBalancer based foo, bar service
17+
hostPort: 31593
18+
protocol: TCP
619

720
- role: worker # configuration for worker1 node
821
extraMounts:

k8s/studies.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Studies
2+
3+
- `IP` 종류 in the point of view of `kubectl`
4+
- **IP**
5+
- TODO
6+
- **CLUSTER-IP**
7+
- TODO
8+
- **EXTERNAL-IP**
9+
- TODO
10+
- **3rd party tools**
11+
- Prometheus
12+
- Istio
13+
- Helm
14+
- Envoy
15+
16+
# Commands
17+
18+
- 특정 pod bash에 접근
19+
20+
```bash
21+
kubectl exec -it <pod name> -- bash # kubectl exec --stdin --tty <pod name> -- /bin/bash
22+
```
23+
24+
- network util pod 생성 및 shell 로그인
25+
26+
```bash
27+
kubectl run <netutil name> --rm -i --tty --image praqma/network-multitool -- bash
28+
```
29+
30+
# DNS 서비스 validation
31+
32+
- References : <https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/>
33+
34+
- dnsutils 설치
35+
36+
```bash
37+
> kubectl apply -f https://k8s.io/examples/admin/dns/dnsutils.yaml
38+
```
39+
40+
- coreDNS가 정상 동작하는지 확인
41+
42+
```bash
43+
> kubectl exec -i -t dnsutils -- nslookup google.com
44+
...
45+
Server: 10.96.0.10
46+
Address: 10.96.0.10#53
47+
48+
Non-authoritative answer:
49+
Name: google.com
50+
Address: 142.251.42.206
51+
52+
> kubectl exec -i -t dnsutils -- nslookup kubernetes.default
53+
...
54+
Server: 10.96.0.10
55+
Address: 10.96.0.10#53
56+
57+
Name: kubernetes.default.svc.cluster.local
58+
Address: 10.96.0.1
59+
```
60+
61+
# Dashboard
62+
63+
- **관련 reference** : `https://kubernetes.io/ko/docs/tasks/access-application-cluster/web-ui-dashboard/`
64+
65+
- **dashboard UI 배포**
66+
67+
```bash
68+
> kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.4.0/aio/deploy/recommended.yaml
69+
...
70+
namespace/kubernetes-dashboard create
71+
serviceaccount/kubernetes-dashboard created
72+
service/kubernetes-dashboard created
73+
secret/kubernetes-dashboard-certs created
74+
secret/kubernetes-dashboard-csrf created
75+
secret/kubernetes-dashboard-key-holder created
76+
configmap/kubernetes-dashboard-settings created
77+
role.rbac.authorization.k8s.io/kubernetes-dashboard created
78+
clusterrole.rbac.authorization.k8s.io/kubernetes-dashboard created
79+
rolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
80+
clusterrolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
81+
deployment.apps/kubernetes-dashboard created
82+
service/dashboard-metrics-scraper created
83+
deployment.apps/dashboard-metrics-scraper created
84+
```
85+
86+
- **정상 배포 확인**
87+
88+
```bash
89+
> kubectl get pod -n kubernetes-dashboard
90+
...
91+
NAME READY STATUS RESTARTS AGE
92+
dashboard-metrics-scraper-c45b7869d-hq2cq 1/1 Running 0 45s
93+
kubernetes-dashboard-576cb95f94-56gxg 1/1 Running 0 45s
94+
```
95+
96+
- **`ClusterRoleBinding` 생성 for admin 권한으로 접근**
97+
98+
```bash
99+
> kubectl create clusterrolebinding default-admin --clusterrole cluster-admin --serviceaccount=default:default
100+
...
101+
clusterrolebinding.rbac.authorization.k8s.io/default-admin created
102+
```
103+
104+
- **로그인 용 token 생성**
105+
106+
```bash
107+
> token=$(kubectl get secrets -o jsonpath="{.items[?(@.metadata.annotations['kubernetes\.io/service-account\.name']=='default')].data.token}"|base64 --decode)
108+
...
109+
> echo $token
110+
...
111+
eyJhbGciOiJSUzI1NiIsImtpZCI6InB0OHNlTWlTdGI5dUg1bzF6eGtSSEY4RjRQc2FMOTBLU3VZcGZEZVhpRUUifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJkZWZhdWx0Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6ImRlZmF1bHQtdG9rZW4tNGdwdDIiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiZGVmYXVsdCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6IjU2Mzg3NWIxLTRlZWEtNGQ5ZS1hOTU5LWJmNWQ0OTIxODIzOCIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDpkZWZhdWx0OmRlZmF1bHQifQ.ZlAkVuFa9y9ugtV1LoqTjmcjwB-s0i65n6Wcf4VzN0oXrhFmPTAqb0n1hmcFGWZzzNgI5G2TQeGndMyey0rFkT4zznQUFtH23Ibe9KI19mmV81urghtjFALinfnq7qHlxbO-0IwpOuTEIOy3Zz1mqbeGFhkeYUtocU1kM_dbSID1wEvIV_TSdDW52DB6N3qIJgEECfCZKhd4APvY39B8SedgJQ5LAQMXLVFaa7BaoVFrEQ4pVD6mkjpfCfndgU6PqnZvTKU1IbYkvqaOvSe4OEFNRwMr7LbM1o4LJDJz4xQdhlKldAeSdC4iGO6T112l2Zw2btqF8rUV_lEwFLmlqw
112+
```
113+
114+
- **dashboard 접속 활성화**
115+
116+
```bash
117+
> kubectl proxy
118+
```
119+
120+
- **dashboard URL (접근)**
121+
122+
```bash
123+
http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
124+
```

0 commit comments

Comments
 (0)