๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Container/Kubernetes

[k8s] Minikube Kubernetes ์šฉ ArgoCD์„ค์น˜

by ganyga 2024. 3. 5.

Minikube๋กœ Kubernetes Cluster ๊ตฌ์„ฑ

minikube start

๐Ÿ˜„  Darwin 14.1.1 (arm64) ์˜ minikube v1.32.0
โœจ  ์ž๋™์ ์œผ๋กœ docker ๋“œ๋ผ์ด๋ฒ„๊ฐ€ ์„ ํƒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๋‹ค๋ฅธ ๋“œ๋ผ์ด๋ฒ„ ๋ชฉ๋ก: vmware, ssh
๐Ÿ“Œ  Using Docker Desktop driver with root privileges
๐Ÿ‘  minikube ํด๋Ÿฌ์Šคํ„ฐ์˜ minikube ์ปจํŠธ๋กค ํ”Œ๋ ˆ์ธ ๋…ธ๋“œ๋ฅผ ์‹œ์ž‘ํ•˜๋Š” ์ค‘
๐Ÿšœ  ๋ฒ ์ด์Šค ์ด๋ฏธ์ง€๋ฅผ ๋‹ค์šด๋ฐ›๋Š” ์ค‘ ...
๐Ÿ”ฅ  Creating docker container (CPUs=2, Memory=4000MB) ...
๐Ÿณ  ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค v1.28.3 ์„ Docker 24.0.7 ๋Ÿฐํƒ€์ž„์œผ๋กœ ์„ค์น˜ํ•˜๋Š” ์ค‘
    โ–ช ์ธ์ฆ์„œ ๋ฐ ํ‚ค๋ฅผ ์ƒ์„ฑํ•˜๋Š” ์ค‘ ...
    โ–ช ์ปจํŠธ๋กค ํ”Œ๋ ˆ์ธ์ด ๋ถ€ํŒ…...
    โ–ช RBAC ๊ทœ์น™์„ ๊ตฌ์„ฑํ•˜๋Š” ์ค‘ ...
๐Ÿ”—  Configuring bridge CNI (Container Networking Interface) ...
๐Ÿ”Ž  Kubernetes ๊ตฌ์„ฑ ์š”์†Œ๋ฅผ ํ™•์ธ...
    โ–ช Using image gcr.io/k8s-minikube/storage-provisioner:v5
๐ŸŒŸ  ์• ๋“œ์˜จ ํ™œ์„ฑํ™” : storage-provisioner, default-storageclass
๐Ÿ„  ๋๋‚ฌ์Šต๋‹ˆ๋‹ค! kubectl์ด "minikube" ํด๋Ÿฌ์Šคํ„ฐ์™€ "default" ๋„ค์ž„์ŠคํŽ˜์ด์Šค๋ฅผ ๊ธฐ๋ณธ์ ์œผ๋กœ ์‚ฌ์šฉํ•˜๋„๋ก ๊ตฌ์„ฑ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.
 
 
kubectl get nodes -o wide

NAME       STATUS   ROLES           AGE   VERSION   INTERNAL-IP    EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION    CONTAINER-RUNTIME
minikube   Ready    control-plane   11s   v1.28.3   192.168.49.2   <none>        Ubuntu 22.04.3 LTS   6.6.16-linuxkit   docker://24.0.7


minikube node add

๐Ÿ˜„  ๋…ธ๋“œ m02 ๋ฅผ ํด๋Ÿฌ์Šคํ„ฐ minikube ์— ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค
โ—  Cluster was created without any CNI, adding a node to it might cause broken networking.
๐Ÿ‘  Starting worker node minikube-m02 in cluster minikube
๐Ÿšœ  ๋ฒ ์ด์Šค ์ด๋ฏธ์ง€๋ฅผ ๋‹ค์šด๋ฐ›๋Š” ์ค‘ ...
๐Ÿ”ฅ  Creating docker container (CPUs=2, Memory=2200MB) ...
๐Ÿณ  ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค v1.28.3 ์„ Docker 24.0.7 ๋Ÿฐํƒ€์ž„์œผ๋กœ ์„ค์น˜ํ•˜๋Š” ์ค‘
๐Ÿ”Ž  Kubernetes ๊ตฌ์„ฑ ์š”์†Œ๋ฅผ ํ™•์ธ...
๐Ÿ„  m02 ๋ฅผ minikube ์— ์„ฑ๊ณต์ ์œผ๋กœ ์ถ”๊ฐ€ํ•˜์˜€์Šต๋‹ˆ๋‹ค!


minikube node add

๐Ÿ˜„  ๋…ธ๋“œ m03 ๋ฅผ ํด๋Ÿฌ์Šคํ„ฐ minikube ์— ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค
๐Ÿ‘  Starting worker node minikube-m03 in cluster minikube
๐Ÿšœ  ๋ฒ ์ด์Šค ์ด๋ฏธ์ง€๋ฅผ ๋‹ค์šด๋ฐ›๋Š” ์ค‘ ...
๐Ÿ”ฅ  Creating docker container (CPUs=2, Memory=2200MB) ...
๐Ÿณ  ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค v1.28.3 ์„ Docker 24.0.7 ๋Ÿฐํƒ€์ž„์œผ๋กœ ์„ค์น˜ํ•˜๋Š” ์ค‘
๐Ÿ”Ž  Kubernetes ๊ตฌ์„ฑ ์š”์†Œ๋ฅผ ํ™•์ธ...
๐Ÿ„  m03 ๋ฅผ minikube ์— ์„ฑ๊ณต์ ์œผ๋กœ ์ถ”๊ฐ€ํ•˜์˜€์Šต๋‹ˆ๋‹ค!

kubectl get nodes -o wide

NAME           STATUS   ROLES           AGE   VERSION   INTERNAL-IP    EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION    CONTAINER-RUNTIME
minikube       Ready    control-plane   83s   v1.28.3   192.168.49.2   <none>        Ubuntu 22.04.3 LTS   6.6.16-linuxkit   docker://24.0.7
minikube-m02   Ready    <none>          49s   v1.28.3   192.168.49.3   <none>        Ubuntu 22.04.3 LTS   6.6.16-linuxkit   docker://24.0.7
minikube-m03   Ready    <none>          8s    v1.28.3   192.168.49.4   <none>        Ubuntu 22.04.3 LTS   6.6.16-linuxkit   docker://24.0.7

 

ArgoCD ์„ค์น˜

https://argo-cd.readthedocs.io/en/stable/getting_started/

 

Getting Started - Argo CD - Declarative GitOps CD for Kubernetes

Getting Started Tip This guide assumes you have a grounding in the tools that Argo CD is based on. Please read understanding the basics to learn about these tools. Requirements Installed kubectl command-line tool. Have a kubeconfig file (default location i

argo-cd.readthedocs.io

kubectl create namespace argocd
namespace/argocd created


kubectl get namespace
NAME              STATUS   AGE
argocd            Active   5s
default           Active   3m19s
kube-node-lease   Active   3m19s
kube-public       Active   3m19s
kube-system       Active   3m19s



kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

customresourcedefinition.apiextensions.k8s.io/applications.argoproj.io created
customresourcedefinition.apiextensions.k8s.io/applicationsets.argoproj.io created
customresourcedefinition.apiextensions.k8s.io/appprojects.argoproj.io created
serviceaccount/argocd-application-controller created
serviceaccount/argocd-applicationset-controller created
serviceaccount/argocd-dex-server created
serviceaccount/argocd-notifications-controller created
serviceaccount/argocd-redis created
serviceaccount/argocd-repo-server created
serviceaccount/argocd-server created
role.rbac.authorization.k8s.io/argocd-application-controller created
role.rbac.authorization.k8s.io/argocd-applicationset-controller created
role.rbac.authorization.k8s.io/argocd-dex-server created
role.rbac.authorization.k8s.io/argocd-notifications-controller created
role.rbac.authorization.k8s.io/argocd-server created
clusterrole.rbac.authorization.k8s.io/argocd-application-controller created
clusterrole.rbac.authorization.k8s.io/argocd-applicationset-controller created
clusterrole.rbac.authorization.k8s.io/argocd-server created
rolebinding.rbac.authorization.k8s.io/argocd-application-controller created
rolebinding.rbac.authorization.k8s.io/argocd-applicationset-controller created
rolebinding.rbac.authorization.k8s.io/argocd-dex-server created
rolebinding.rbac.authorization.k8s.io/argocd-notifications-controller created
rolebinding.rbac.authorization.k8s.io/argocd-server created
clusterrolebinding.rbac.authorization.k8s.io/argocd-application-controller created
clusterrolebinding.rbac.authorization.k8s.io/argocd-applicationset-controller created
clusterrolebinding.rbac.authorization.k8s.io/argocd-server created
configmap/argocd-cm created
configmap/argocd-cmd-params-cm created
configmap/argocd-gpg-keys-cm created
configmap/argocd-notifications-cm created
configmap/argocd-rbac-cm created
configmap/argocd-ssh-known-hosts-cm created
configmap/argocd-tls-certs-cm created
secret/argocd-notifications-secret created
secret/argocd-secret created
service/argocd-applicationset-controller created
service/argocd-dex-server created
service/argocd-metrics created
service/argocd-notifications-controller-metrics created
service/argocd-redis created
service/argocd-repo-server created
service/argocd-server created
service/argocd-server-metrics created
deployment.apps/argocd-applicationset-controller created
deployment.apps/argocd-dex-server created
deployment.apps/argocd-notifications-controller created
deployment.apps/argocd-redis created
deployment.apps/argocd-repo-server created
deployment.apps/argocd-server created
statefulset.apps/argocd-application-controller created
networkpolicy.networking.k8s.io/argocd-application-controller-network-policy created
networkpolicy.networking.k8s.io/argocd-applicationset-controller-network-policy created
networkpolicy.networking.k8s.io/argocd-dex-server-network-policy created
networkpolicy.networking.k8s.io/argocd-notifications-controller-network-policy created
networkpolicy.networking.k8s.io/argocd-redis-network-policy created
networkpolicy.networking.k8s.io/argocd-repo-server-network-policy created
networkpolicy.networking.k8s.io/argocd-server-network-policy created

 

kubectl get all -n argocd
NAME                                                    READY   STATUS    RESTARTS   AGE
pod/argocd-application-controller-0                     1/1     Running   0          3m10s
pod/argocd-applicationset-controller-5478c64d7c-9jj2j   1/1     Running   0          3m10s
pod/argocd-dex-server-6fcfc6f94d-k7zm4                  1/1     Running   0          3m10s
pod/argocd-notifications-controller-5f6c747849-sr8f7    1/1     Running   0          3m10s
pod/argocd-redis-66d9777b78-fvg7d                       1/1     Running   0          3m10s
pod/argocd-repo-server-5c7d64b8bf-bt7lp                 1/1     Running   0          3m10s
pod/argocd-server-56f7986dff-9k274                      1/1     Running   0          3m10s

NAME                                              TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
service/argocd-applicationset-controller          ClusterIP   10.103.18.243    <none>        7000/TCP,8080/TCP            3m11s
service/argocd-dex-server                         ClusterIP   10.100.178.113   <none>        5556/TCP,5557/TCP,5558/TCP   3m11s
service/argocd-metrics                            ClusterIP   10.108.118.171   <none>        8082/TCP                     3m11s
service/argocd-notifications-controller-metrics   ClusterIP   10.99.70.179     <none>        9001/TCP                     3m11s
service/argocd-redis                              ClusterIP   10.110.1.48      <none>        6379/TCP                     3m11s
service/argocd-repo-server                        ClusterIP   10.110.203.147   <none>        8081/TCP,8084/TCP            3m11s
service/argocd-server                             ClusterIP   10.97.74.94      <none>        80/TCP,443/TCP               3m11s
service/argocd-server-metrics                     ClusterIP   10.109.119.47    <none>        8083/TCP                     3m10s

NAME                                               READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/argocd-applicationset-controller   1/1     1            1           3m10s
deployment.apps/argocd-dex-server                  1/1     1            1           3m10s
deployment.apps/argocd-notifications-controller    1/1     1            1           3m10s
deployment.apps/argocd-redis                       1/1     1            1           3m10s
deployment.apps/argocd-repo-server                 1/1     1            1           3m10s
deployment.apps/argocd-server                      1/1     1            1           3m10s

NAME                                                          DESIRED   CURRENT   READY   AGE
replicaset.apps/argocd-applicationset-controller-5478c64d7c   1         1         1       3m10s
replicaset.apps/argocd-dex-server-6fcfc6f94d                  1         1         1       3m10s
replicaset.apps/argocd-notifications-controller-5f6c747849    1         1         1       3m10s
replicaset.apps/argocd-redis-66d9777b78                       1         1         1       3m10s
replicaset.apps/argocd-repo-server-5c7d64b8bf                 1         1         1       3m10s
replicaset.apps/argocd-server-56f7986dff                      1         1         1       3m10s

NAME                                             READY   AGE
statefulset.apps/argocd-application-controller   1/1     3m10s

 

ArgoCD API ์„œ๋ฒ„ ์•ก์„ธ์Šค

๊ธฐ๋ณธ์ ์œผ๋กœ ArgoCD API ์„œ๋ฒ„๋Š” ์™ธ๋ถ€ IP๋กœ ๋…ธ์ถœ๋˜์ง€ ์•Š์Œ

 

argocd-server ์„œ๋น„์Šค ์œ ํ˜•์„ LoadBalancer ํƒ€์ž…์œผ๋กœ ๋ฐ”๊ฟ”์ฃผ๊ธฐ

kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'

 

service Type์ด LoadBalancer๋กœ ๋ฐ”๋€Œ์—ˆ์ง€๋งŒ EXTERNAL-IP๋Š” Pending ์ƒํƒœ

kubectl get svc -n argocd
NAME                                      TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
argocd-applicationset-controller          ClusterIP      10.103.18.243    <none>        7000/TCP,8080/TCP            5m33s
argocd-dex-server                         ClusterIP      10.100.178.113   <none>        5556/TCP,5557/TCP,5558/TCP   5m33s
argocd-metrics                            ClusterIP      10.108.118.171   <none>        8082/TCP                     5m33s
argocd-notifications-controller-metrics   ClusterIP      10.99.70.179     <none>        9001/TCP                     5m33s
argocd-redis                              ClusterIP      10.110.1.48      <none>        6379/TCP                     5m33s
argocd-repo-server                        ClusterIP      10.110.203.147   <none>        8081/TCP,8084/TCP            5m33s
argocd-server                             LoadBalancer   10.97.74.94      <pending>     80:31746/TCP,443:30945/TCP   5m33s
argocd-server-metrics                     ClusterIP      10.109.119.47    <none>        8083/TCP                     5m32s

 

Minikube LoadBalancer ์•ก์„ธ์Šค ํ•˜๊ธฐ

์ƒˆ ํ„ฐ๋ฏธ๋„ ์—ด์–ด์„œ ์•„๋ž˜ ๋ช…๋ น์–ด ์ž…๋ ฅ

minikube tunnel

pending -> 127.0.0.1

kubectl get svc -n argocd
NAME                                      TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
argocd-applicationset-controller          ClusterIP      10.103.18.243    <none>        7000/TCP,8080/TCP            7m25s
argocd-dex-server                         ClusterIP      10.100.178.113   <none>        5556/TCP,5557/TCP,5558/TCP   7m25s
argocd-metrics                            ClusterIP      10.108.118.171   <none>        8082/TCP                     7m25s
argocd-notifications-controller-metrics   ClusterIP      10.99.70.179     <none>        9001/TCP                     7m25s
argocd-redis                              ClusterIP      10.110.1.48      <none>        6379/TCP                     7m25s
argocd-repo-server                        ClusterIP      10.110.203.147   <none>        8081/TCP,8084/TCP            7m25s
argocd-server                             LoadBalancer   10.97.74.94      127.0.0.1     80:31746/TCP,443:30945/TCP   7m25s
argocd-server-metrics                     ClusterIP      10.109.119.47    <none>        8083/TCP

 

minikube service list
|-------------|-----------------------------------------|--------------|-----|
|  NAMESPACE  |                  NAME                   | TARGET PORT  | URL |
|-------------|-----------------------------------------|--------------|-----|
| argocd      | argocd-applicationset-controller        | No node port |     |
| argocd      | argocd-dex-server                       | No node port |     |
| argocd      | argocd-metrics                          | No node port |     |
| argocd      | argocd-notifications-controller-metrics | No node port |     |
| argocd      | argocd-redis                            | No node port |     |
| argocd      | argocd-repo-server                      | No node port |     |
| argocd      | argocd-server                           | http/80      |     |
|             |                                         | https/443    |     |
| argocd      | argocd-server-metrics                   | No node port |     |
| default     | kubernetes                              | No node port |     |
| kube-system | kube-dns                                | No node port |     |
|-------------|-----------------------------------------|--------------|-----|

 

 minikube service argocd-server -n argocd
|-----------|---------------|-------------|---------------------------|
| NAMESPACE |     NAME      | TARGET PORT |            URL            |
|-----------|---------------|-------------|---------------------------|
| argocd    | argocd-server | http/80     | http://192.168.49.2:31746 |
|           |               | https/443   | http://192.168.49.2:30945 |
|-----------|---------------|-------------|---------------------------|
๐Ÿƒ  argocd-server ์„œ๋น„์Šค์˜ ํ„ฐ๋„์„ ์‹œ์ž‘ํ•˜๋Š” ์ค‘
|-----------|---------------|-------------|------------------------|
| NAMESPACE |     NAME      | TARGET PORT |          URL           |
|-----------|---------------|-------------|------------------------|
| argocd    | argocd-server |             | http://127.0.0.1:60396 |
|           |               |             | http://127.0.0.1:60397 |
|-----------|---------------|-------------|------------------------|
[argocd argocd-server  http://127.0.0.1:60396
http://127.0.0.1:60397]
โ—  Because you are using a Docker driver on darwin, the terminal needs to be open to run it.

 

[argocd argocd-server  http://127.0.0.1:60396
http://127.0.0.1:60397]

์•Œ๋ ค์ค€ ์ฃผ์†Œ๋กœ ์›น ๋ธŒ๋ผ์šฐ์ €์—์„œ ์ ‘์† ( ๊ณ ๊ธ‰ > ์•ˆ์ „ํ•˜์ง€ ์•Š์Œ)

 

์ดˆ๊ธฐ admin ๊ณ„์ • password ์กฐํšŒ

kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo
tqQOvBy86mK486Kg

 

๋กœ๊ทธ์ธ ํ™”๋ฉด

 

์ดˆ๊ธฐ password ๋ณ€๊ฒฝํ•˜๊ธฐ

User Info > UPDATE PASSWORD