{"id":12049,"date":"2026-09-26T21:05:49","date_gmt":"2026-09-26T12:05:49","guid":{"rendered":"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=12049"},"modified":"2026-10-13T18:00:48","modified_gmt":"2026-10-13T09:00:48","slug":"kubernetes-aws-ec2-%eb%8b%a8%ec%9d%bc-%eb%85%b8%eb%93%9c%ec%97%90-argocd-nginx-%ea%b5%ac%ec%84%b1%ed%95%98%ea%b8%b0-gitops-private-%ec%a0%80%ec%9e%a5%ec%86%8c","status":"publish","type":"post","link":"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=12049","title":{"rendered":"Kubernetes \u2013 AWS EC2 \ub2e8\uc77c \ub178\ub4dc\uc5d0 ArgoCD + nginx \uad6c\uc131\ud558\uae30 (GitOps, Private \uc800\uc7a5\uc18c)"},"content":{"rendered":"<h1>Kubernetes \u2013 AWS EC2 \ub2e8\uc77c \ub178\ub4dc\uc5d0 ArgoCD + nginx \uad6c\uc131\ud558\uae30 (GitOps, Private \uc800\uc7a5\uc18c)<\/h1>\n<p>AWS EC2 \uc778\uc2a4\ud134\uc2a4 \ud55c \ub300\uc5d0 kubeadm \uc73c\ub85c \ucfe0\ubc84\ub124\ud2f0\uc2a4\ub97c \uc124\uce58\ud558\uace0, <strong>ArgoCD<\/strong> \uc640 <strong>nginx<\/strong> \ub9cc \uc62c\ub9ac\ub294 \ucd5c\uc18c \uad6c\uc131\uc785\ub2c8\ub2e4.<br \/>\n\ubaa8\ub4e0 \uc124\uc815\uc740 <strong>GitHub Private \uc800\uc7a5\uc18c<\/strong>\uc5d0 \ub450\uace0, \ubc30\ud3ec\ub294 ArgoCD \uac00 Git \uc744 \ubcf4\uace0 \uc218\ud589\ud569\ub2c8\ub2e4.<\/p>\n<p>EC2 \ub294 \uba54\ubaa8\ub9ac\uac00 4GB \uc774\uc0c1\uc774\uc5b4\uc57c \ud558\uace0, \uc6b0\ubd84\ud22c OS \uc5ec\uc57c \ud569\ub2c8\ub2e4.<\/p>\n<p>\uc218\ub3d9\uc73c\ub85c \ud558\ub294 \uc791\uc5c5\uc740 \ub2e4\uc74c \ub450 \uac00\uc9c0\ubfd0\uc785\ub2c8\ub2e4.<\/p>\n<ol>\n<li><code>helm install<\/code> \ub85c ArgoCD \ucd5c\ucd08 \uc124\uce58<\/li>\n<li><code>kubectl apply<\/code> \ub85c \ub8e8\ud2b8 Application \uc801\uc6a9<\/li>\n<\/ol>\n<p>\uadf8 \uc774\ud6c4\ub85c\ub294 <strong>Git push \ub9cc\uc73c\ub85c<\/strong> \ubc30\ud3ec\ud569\ub2c8\ub2e4.<\/p>\n<hr \/>\n<h2>0. \uc804\uccb4 \uad6c\uc870<\/h2>\n<pre><code class=\"language-text\">GitHub (Private)                                  EC2 (\ub2e8\uc77c \ub178\ub4dc Kubernetes)\nk8s-gitops-aws\/                                 \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u251c\u2500\u2500 bootstrap\/root-app.yaml  \u2500\u2500 (one time) \u2500\u2500\u25b6 \u2502 ArgoCD                    \u2502\n\u251c\u2500\u2500 apps\/                                       \u2502  \u251c\u2500 argocd (Self-managed) \u2502\n\u2502   \u251c\u2500\u2500 argocd.yaml          \u25c0\u2500\u2500 monitor \u2500\u2500\u2500   \u2502  \u2514\u2500 nginx                 \u2502\n\u2502   \u2514\u2500\u2500 nginx.yaml                              \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n\u251c\u2500\u2500 values\/                    # \u2605 \ud658\uacbd \uc124\uc815\uc740 \uc804\ubd80 \uc5ec\uae30\n\u2502   \u251c\u2500\u2500 argocd\/values.yaml\n\u2502   \u2514\u2500\u2500 nginx\/values.yaml\n\u2514\u2500\u2500 charts\/nginx\/              # \uc790\uccb4 \uc571 \ucc28\ud2b8 (\uacf5\uac1c \ucc28\ud2b8\uac00 \uc5c6\ub294 \uac83\ub9cc)\n    \u251c\u2500\u2500 Chart.yaml\n    \u251c\u2500\u2500 values.yaml\n    \u2514\u2500\u2500 templates\/\n        \u251c\u2500\u2500 deployment.yaml\n        \u2514\u2500\u2500 service.yaml<\/code><\/pre>\n<ul>\n<li><code>apps\/*.yaml<\/code> : <strong>\ubb34\uc5c7\uc744, \uc5b4\ub290 \ubc84\uc804\uc73c\ub85c<\/strong> \uc124\uce58\ud560\uc9c0<\/li>\n<li><code>values\/*\/values.yaml<\/code> : <strong>\uc5b4\ub5bb\uac8c<\/strong> \uc124\uce58\ud560\uc9c0<\/li>\n<li>\ucc28\ud2b8\ub294 Helm \uc800\uc7a5\uc18c(ArgoCD) \ub610\ub294 <code>charts\/<\/code>(nginx)\uc5d0\uc11c \uac00\uc838\uc624\uace0, \uc124\uc815\uc740 \ud56d\uc0c1 <code>values\/<\/code> \uc5d0\uc11c \uac00\uc838\uc635\ub2c8\ub2e4.<\/li>\n<\/ul>\n<table>\n<thead>\n<tr>\n<th>\uc11c\ube44\uc2a4<\/th>\n<th>\uc811\uc18d \uc8fc\uc18c<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>ArgoCD<\/td>\n<td><code>https:\/\/&lt;EC2_PUBLIC_IP&gt;:30443\/<\/code><\/td>\n<\/tr>\n<tr>\n<td>nginx<\/td>\n<td><code>http:\/\/&lt;EC2_PUBLIC_IP&gt;:31405\/<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2>1. EC2 \uc778\uc2a4\ud134\uc2a4 \uc900\ube44<\/h2>\n<table>\n<thead>\n<tr>\n<th>\ud56d\ubaa9<\/th>\n<th>\uac12<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>AMI<\/td>\n<td>Ubuntu 26.04 (x86_64)<\/td>\n<\/tr>\n<tr>\n<td>\uc778\uc2a4\ud134\uc2a4 \ud0c0\uc785<\/td>\n<td><code>t3.medium<\/code> \uc774\uc0c1 (vCPU 2, \uba54\ubaa8\ub9ac 4GB)<\/td>\n<\/tr>\n<tr>\n<td>\uc2a4\ud1a0\ub9ac\uc9c0<\/td>\n<td>20GB \uc774\uc0c1 (gp3)<\/td>\n<\/tr>\n<tr>\n<td>\uae30\ubcf8 \uc0ac\uc6a9\uc790<\/td>\n<td><code>admin<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>\ubcf4\uc548 \uadf8\ub8f9 \uc778\ubc14\uc6b4\ub4dc \uaddc\uce59<\/strong><\/p>\n<table>\n<thead>\n<tr>\n<th>\ud3ec\ud2b8<\/th>\n<th>\uc6a9\ub3c4<\/th>\n<th>\uc18c\uc2a4<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>22<\/td>\n<td>SSH<\/td>\n<td>\ub0b4 IP<\/td>\n<\/tr>\n<tr>\n<td>30443<\/td>\n<td>ArgoCD UI<\/td>\n<td>\ub0b4 IP<\/td>\n<\/tr>\n<tr>\n<td>31405<\/td>\n<td>nginx<\/td>\n<td>0.0.0.0\/0 (\ud544\uc694 \uc2dc)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<blockquote>\n<p>6443(API \uc11c\ubc84)\uc740 \uc678\ubd80\uc5d0 \uc5f4 \ud544\uc694\uac00 \uc5c6\uc2b5\ub2c8\ub2e4. kubectl \uc740 EC2 \uc548\uc5d0\uc11c \uc2e4\ud589\ud569\ub2c8\ub2e4.<\/p>\n<\/blockquote>\n<hr \/>\n<h2>2. Kubernetes \uc124\uce58<\/h2>\n<p>EC2 \uc5d0 SSH \ub85c \uc811\uc18d\ud574\uc11c \uc9c4\ud589\ud569\ub2c8\ub2e4.<\/p>\n<h3>2.1 \uae30\ubcf8 \ud328\ud0a4\uc9c0 \/ \uc2a4\uc651 \ube44\ud65c\uc131\ud654<\/h3>\n<pre><code class=\"language-bash\">sudo apt update &amp;&amp; sudo apt upgrade -y\nsudo apt install -y curl gnupg ca-certificates apt-transport-https git\n\n# EC2 \ub294 \uae30\ubcf8\uc801\uc73c\ub85c \uc2a4\uc651\uc774 \uc5c6\uc9c0\ub9cc, \ud639\uc2dc \ubaa8\ub974\ub2c8 \ube44\ud65c\uc131\ud654\nsudo swapoff -a\nsudo sed -i &#039;\/ swap \/ s\/^\\(.*\\)$\/#\\1\/g&#039; \/etc\/fstab<\/code><\/pre>\n<h3>2.2 \ucee4\ub110 \ubaa8\ub4c8 \/ \ub124\ud2b8\uc6cc\ud06c \uc124\uc815<\/h3>\n<pre><code class=\"language-bash\">cat &lt;&lt;EOF | sudo tee \/etc\/modules-load.d\/k8s.conf\noverlay\nbr_netfilter\nEOF\nsudo modprobe overlay\nsudo modprobe br_netfilter\n\ncat &lt;&lt;EOF | sudo tee \/etc\/sysctl.d\/k8s.conf\nnet.bridge.bridge-nf-call-ip6tables = 1\nnet.bridge.bridge-nf-call-iptables  = 1\nnet.ipv4.ip_forward                 = 1\nEOF\nsudo sysctl --system<\/code><\/pre>\n<h3>2.3 containerd \uc124\uce58<\/h3>\n<p>kubeadm \ud074\ub7ec\uc2a4\ud130\ub294 Docker \uac00 \ud544\uc694 \uc5c6\uc2b5\ub2c8\ub2e4. <strong>containerd \ub9cc<\/strong> \uc124\uce58\ud569\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-bash\">sudo apt install -y containerd\n\nsudo mkdir -p \/etc\/containerd\ncontainerd config default | sudo tee \/etc\/containerd\/config.toml &gt; \/dev\/null\nsudo sed -i &#039;s\/SystemdCgroup = false\/SystemdCgroup = true\/&#039; \/etc\/containerd\/config.toml\nsudo systemctl restart containerd\nsudo systemctl enable containerd\n\n# true \ub85c \ubc14\ub00c\uc5c8\ub294\uc9c0 \ud655\uc778\ngrep SystemdCgroup \/etc\/containerd\/config.toml<\/code><\/pre>\n<h3>2.4 kubelet \/ kubeadm \/ kubectl \uc124\uce58<\/h3>\n<pre><code class=\"language-bash\">VER=v1.34\ncurl -fsSL https:\/\/pkgs.k8s.io\/core:\/stable:\/$VER\/deb\/Release.key | sudo gpg --dearmor --yes -o \/etc\/apt\/keyrings\/kubernetes-apt-keyring.gpg\necho &quot;deb [signed-by=\/etc\/apt\/keyrings\/kubernetes-apt-keyring.gpg] https:\/\/pkgs.k8s.io\/core:\/stable:\/$VER\/deb\/ \/&quot; \\\n  | sudo tee \/etc\/apt\/sources.list.d\/kubernetes.list\n\nsudo apt update\nsudo apt install -y kubelet kubeadm kubectl\nsudo apt-mark hold kubelet kubeadm kubectl<\/code><\/pre>\n<h3>2.5 \ud074\ub7ec\uc2a4\ud130 \ucd08\uae30\ud654<\/h3>\n<pre><code class=\"language-bash\">sudo kubeadm init --pod-network-cidr=10.244.0.0\/16\n\nmkdir -p $HOME\/.kube\nsudo cp -i \/etc\/kubernetes\/admin.conf $HOME\/.kube\/config\nsudo chown $(id -u):$(id -g) $HOME\/.kube\/config\n\n# \ub124\ud2b8\uc6cc\ud06c \ud50c\ub7ec\uadf8\uc778 (Flannel)\nkubectl apply -f https:\/\/github.com\/flannel-io\/flannel\/releases\/latest\/download\/kube-flannel.yml\n\n# \ub2e8\uc77c \ub178\ub4dc\uc774\ubbc0\ub85c \ucee8\ud2b8\ub864 \ud50c\ub808\uc778\uc5d0\ub3c4 \ud30c\ub4dc \ubc30\uce58 \ud5c8\uc6a9 (\ub05d\uc758 - \ub294 \uc624\ud0c0 \uc544\ub2d8)\nkubectl taint nodes --all node-role.kubernetes.io\/control-plane-<\/code><\/pre>\n<p>\ub178\ub4dc\uac00 <code>Ready<\/code> \uac00 \ub418\uba74 \uc644\ub8cc\uc785\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-bash\">kubectl get nodes<\/code><\/pre>\n<blockquote>\n<p>\ucd08\uae30\ud654\uc5d0 \uc2e4\ud328\ud588\ub2e4\uba74 <code>sudo kubeadm reset -f<\/code> \ud6c4 \ub2e4\uc2dc \uc2e4\ud589\ud569\ub2c8\ub2e4.<br \/>\n\ub85c\uadf8\ub294 <code>sudo journalctl -u kubelet -f<\/code> \ub85c \ud655\uc778\ud569\ub2c8\ub2e4.<\/p>\n<\/blockquote>\n<h3>2.6 Helm \uc124\uce58<\/h3>\n<p>ArgoCD \ucd5c\ucd08 \uc124\uce58(\ubd80\ud2b8\uc2a4\ud2b8\ub7a9)\uc5d0\ub9cc \uc0ac\uc6a9\ud569\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-bash\">curl -fsSL https:\/\/raw.githubusercontent.com\/helm\/helm\/main\/scripts\/get-helm-4 | bash\nhelm version\n\nhelm repo add argo https:\/\/argoproj.github.io\/argo-helm\nhelm repo update\nhelm search repo argo\/argo-cd     # CHART VERSION \ud655\uc778<\/code><\/pre>\n<hr \/>\n<h2>3. Git \uc800\uc7a5\uc18c \uc791\uc131 (\ub85c\uceec PC)<\/h2>\n<p>GitHub \uc5d0 <strong>Private<\/strong> \uc800\uc7a5\uc18c <code>k8s-gitops-aws<\/code> \ub97c \ub9cc\ub4e4\uace0, \uc544\ub798 \ud30c\uc77c\ub4e4\uc744 \uc791\uc131\ud569\ub2c8\ub2e4.<br \/>\n\uc774\ud558 <code>&lt;YOUR_ID&gt;<\/code> \ub294 \ubcf8\uc778 GitHub \uc544\uc774\ub514\ub85c \ubc14\uafc9\ub2c8\ub2e4.<\/p>\n<h3>3.1 values\/argocd\/values.yaml<\/h3>\n<pre><code class=\"language-yaml\">server:\n  service:\n    type: NodePort\n    nodePortHttp: 30080\n    nodePortHttps: 30443\n\n# \ub2e8\uc77c \uc0ac\uc6a9\uc790 \ud658\uacbd\uc5d0\uc11c\ub294 \ubd88\ud544\uc694 \u2192 \uba54\ubaa8\ub9ac \uc808\uc57d\ndex:\n  enabled: false\nnotifications:\n  enabled: false<\/code><\/pre>\n<h3>3.2 nginx \ucc28\ud2b8: charts\/nginx<\/h3>\n<p>nginx \uc6a9 \ucd5c\uc18c Helm \ucc28\ud2b8\uc785\ub2c8\ub2e4. \ucc28\ud2b8 \uae30\ubcf8\uac12(<code>charts\/nginx\/values.yaml<\/code>)\uacfc \ud658\uacbd \uc124\uc815(<code>values\/nginx\/values.yaml<\/code>)\uc744 \ubd84\ub9ac\ud574 \ub450\uba74,<br \/>\n\ub098\uc911\uc5d0 \ud658\uacbd\uc744 \ucd94\uac00\ud558\uac70\ub098 \ucc28\ud2b8\ub97c \ub2e4\ub978 \uc800\uc7a5\uc18c\ub85c \uc62e\uae38 \ub54c values \ub9cc \ucd94\uac00\ud558\uba74 \ub429\ub2c8\ub2e4.<\/p>\n<p><code>charts\/nginx\/Chart.yaml<\/code><\/p>\n<pre><code class=\"language-yaml\">apiVersion: v2\nname: nginx\ndescription: nginx web server\ntype: application\nversion: 0.1.0\nappVersion: &quot;1.29&quot;<\/code><\/pre>\n<p><code>charts\/nginx\/values.yaml<\/code> (\ucc28\ud2b8 \uae30\ubcf8\uac12)<\/p>\n<pre><code class=\"language-yaml\">replicaCount: 1\n\nimage:\n  repository: nginx\n  tag: &quot;&quot;              # \ube44\uc6b0\uba74 appVersion \uc0ac\uc6a9\n\nservice:\n  type: ClusterIP\n  port: 80\n  nodePort: null<\/code><\/pre>\n<p><code>charts\/nginx\/templates\/deployment.yaml<\/code><\/p>\n<pre><code class=\"language-yaml\">apiVersion: apps\/v1\nkind: Deployment\nmetadata:\n  name: {{ .Release.Name }}\n  labels:\n    app: {{ .Release.Name }}\nspec:\n  replicas: {{ .Values.replicaCount }}\n  selector:\n    matchLabels:\n      app: {{ .Release.Name }}\n  template:\n    metadata:\n      labels:\n        app: {{ .Release.Name }}\n    spec:\n      containers:\n        - name: nginx\n          image: &quot;{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}&quot;\n          ports:\n            - containerPort: 80<\/code><\/pre>\n<p><code>charts\/nginx\/templates\/service.yaml<\/code><\/p>\n<pre><code class=\"language-yaml\">apiVersion: v1\nkind: Service\nmetadata:\n  name: {{ .Release.Name }}\nspec:\n  type: {{ .Values.service.type }}\n  selector:\n    app: {{ .Release.Name }}\n  ports:\n    - port: {{ .Values.service.port }}\n      targetPort: 80\n      {{- if and (eq .Values.service.type &quot;NodePort&quot;) .Values.service.nodePort }}\n      nodePort: {{ .Values.service.nodePort }}\n      {{- end }}<\/code><\/pre>\n<h3>3.3 values\/nginx\/values.yaml (\uc774 \ud074\ub7ec\uc2a4\ud130\uc758 \uc2e4\uc81c \uc124\uc815)<\/h3>\n<pre><code class=\"language-yaml\">replicaCount: 2\n\nservice:\n  type: NodePort\n  nodePort: 31405<\/code><\/pre>\n<h3>3.4 apps\/nginx.yaml<\/h3>\n<p>ArgoCD \uc640 \uac19\uc740 multi-source \ud615\ud0dc\ub85c \uc791\uc131\ud569\ub2c8\ub2e4. \ucc28\ud2b8\uc640 values \uac00 \uac19\uc740 \uc800\uc7a5\uc18c\uc5d0 \uc788\uc9c0\ub9cc \ud615\ud0dc\ub97c \ud1b5\uc77c\ud574 \ub450\uba74,<br \/>\n\ub098\uc911\uc5d0 \ucc28\ud2b8\ub97c \ub2e4\ub978 \uacf3\uc73c\ub85c \uc62e\uaca8\ub3c4 \uccab \ubc88\uc9f8 source \ub9cc \ubc14\uafb8\uba74 \ub429\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-yaml\">apiVersion: argoproj.io\/v1alpha1\nkind: Application\nmetadata:\n  name: nginx\n  namespace: argocd\n  finalizers:\n    - resources-finalizer.argocd.argoproj.io\nspec:\n  project: default\n  sources:\n    # \u2460 \ucc28\ud2b8: \ub0b4 \uc800\uc7a5\uc18c\uc758 charts\/nginx\n    - repoURL: https:\/\/github.com\/&lt;YOUR_ID&gt;\/k8s-gitops-aws.git\n      targetRevision: main\n      path: charts\/nginx\n      helm:\n        releaseName: nginx\n        valueFiles:\n          - $values\/values\/nginx\/values.yaml\n    # \u2461 values: \ub0b4 \uc800\uc7a5\uc18c (ref \uc774\ub984\uc774 \uc704\uc758 $values \uac00 \ub428)\n    - repoURL: https:\/\/github.com\/&lt;YOUR_ID&gt;\/k8s-gitops-aws.git\n      targetRevision: main\n      ref: values\n  destination:\n    server: https:\/\/kubernetes.default.svc\n    namespace: default\n  syncPolicy:\n    automated:\n      prune: true      # Git \uc5d0\uc11c \uc9c0\uc6b4 \ub9ac\uc18c\uc2a4\ub294 \ud074\ub7ec\uc2a4\ud130\uc5d0\uc11c\ub3c4 \uc0ad\uc81c\n      selfHeal: true   # kubectl \ub85c \uc9c1\uc811 \ubc14\uafd4\ub3c4 Git \uc0c1\ud0dc\ub85c \ub418\ub3cc\ub9bc<\/code><\/pre>\n<h3>3.5 apps\/argocd.yaml (ArgoCD \uac00 \uc790\uae30 \uc790\uc2e0\uc744 \uad00\ub9ac)<\/h3>\n<p>\ucc28\ud2b8\ub294 Helm \uc800\uc7a5\uc18c\uc5d0\uc11c, values \ub294 \ub0b4 Git \uc800\uc7a5\uc18c\uc5d0\uc11c \uac00\uc838\uc624\ub294 <strong>multi-source<\/strong> \ubc29\uc2dd\uc785\ub2c8\ub2e4.<br \/>\n<code>releaseName<\/code>, <code>namespace<\/code>, \ucc28\ud2b8 \ubc84\uc804, values \uac00 <strong>4.1 \uc758 <code>helm install<\/code> \uacfc \uac19\uc544\uc57c<\/strong> \ucda9\ub3cc \uc5c6\uc774 \uc778\uc218\ub429\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-yaml\">apiVersion: argoproj.io\/v1alpha1\nkind: Application\nmetadata:\n  name: argocd\n  namespace: argocd\n  # finalizer \uc5c6\uc74c: Application \uc744 \uc2e4\uc218\ub85c \uc9c0\uc6cc\ub3c4 ArgoCD \ub294 \ub0a8\ub3c4\ub85d\nspec:\n  project: default\n  sources:\n    - repoURL: https:\/\/argoproj.github.io\/argo-helm\n      chart: argo-cd\n      targetRevision: 10.9.5          # helm search repo \uacb0\uacfc\ub85c \ubcc0\uacbd\n      helm:\n        releaseName: argocd\n        valueFiles:\n          - $values\/values\/argocd\/values.yaml\n    - repoURL: https:\/\/github.com\/&lt;YOUR_ID&gt;\/k8s-gitops-aws.git\n      targetRevision: main\n      ref: values                     # \uc704\uc758 $values \uac00 \uc774 \uc800\uc7a5\uc18c\ub97c \uac00\ub9ac\ud0b4\n  destination:\n    server: https:\/\/kubernetes.default.svc\n    namespace: argocd\n  syncPolicy:\n    automated:\n      prune: false\n      selfHeal: true\n    syncOptions:\n      - ServerSideApply=true          # ArgoCD CRD \ud06c\uae30 \uc81c\ud55c \ud68c\ud53c<\/code><\/pre>\n<h3>3.6 bootstrap\/root-app.yaml (App of Apps)<\/h3>\n<p><code>apps\/<\/code> \ub514\ub809\ud130\ub9ac\ub97c \ubc14\ub77c\ubcf4\ub294 \ub8e8\ud2b8 Application \uc785\ub2c8\ub2e4. \uc774\uac83 \ud558\ub098\ub9cc \uc218\ub3d9\uc73c\ub85c \uc801\uc6a9\ud569\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-yaml\">apiVersion: argoproj.io\/v1alpha1\nkind: Application\nmetadata:\n  name: root\n  namespace: argocd\nspec:\n  project: default\n  source:\n    repoURL: https:\/\/github.com\/&lt;YOUR_ID&gt;\/k8s-gitops-aws.git\n    targetRevision: main\n    path: apps\n  destination:\n    server: https:\/\/kubernetes.default.svc\n    namespace: argocd\n  syncPolicy:\n    automated:\n      prune: true\n      selfHeal: true<\/code><\/pre>\n<h3>3.7 push<\/h3>\n<pre><code class=\"language-bash\">git add .\ngit commit -m &quot;argocd + nginx&quot;\ngit push origin main<\/code><\/pre>\n<hr \/>\n<h2>4. ArgoCD \uc124\uce58 \ubc0f \uc801\uc6a9 (EC2)<\/h2>\n<h3>4.1 GitHub \ud1a0\ud070 \ubc1c\uae09<\/h3>\n<p>GitHub \u2192 Settings \u2192 Developer settings \u2192 <strong>Fine-grained tokens<\/strong> \uc5d0\uc11c \ud1a0\ud070\uc744 \ubc1c\uae09\ud569\ub2c8\ub2e4.<\/p>\n<ul>\n<li>Repository access: <code>k8s-gitops-aws<\/code> \ub9cc \uc120\ud0dd<\/li>\n<li>Permissions: <strong>Contents \u2192 Read-only<\/strong><\/li>\n<\/ul>\n<h3>4.2 \uc800\uc7a5\uc18c clone \ud6c4 ArgoCD \uc124\uce58<\/h3>\n<p>Git \uc758 values \ud30c\uc77c\uc744 \uadf8\ub300\ub85c \uc0ac\uc6a9\ud574\uc11c \uc124\uce58\ud569\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-bash\">git clone https:\/\/&lt;YOUR_ID&gt;:&lt;GITHUB_TOKEN&gt;@github.com\/&lt;YOUR_ID&gt;\/k8s-gitops-aws.git\ncd k8s-gitops-aws\n\nhelm install argocd argo\/argo-cd \\\n  --namespace argocd --create-namespace \\\n  --version 10.9.5 \\\n  -f values\/argocd\/values.yaml\n\nkubectl -n argocd get pods -w     # \ubaa8\ub450 Running \uc774 \ub420 \ub54c\uae4c\uc9c0 \ub300\uae30<\/code><\/pre>\n<h3>4.3 Private \uc800\uc7a5\uc18c \ub4f1\ub85d<\/h3>\n<p>ArgoCD \uac00 Private \uc800\uc7a5\uc18c\ub97c \uc77d\uc744 \uc218 \uc788\ub3c4\ub85d \uc778\uc99d \uc815\ubcf4\ub97c Secret \uc73c\ub85c \ub4f1\ub85d\ud569\ub2c8\ub2e4.<br \/>\n\uc774 Secret \uc740 <strong>Git \uc5d0 \ucee4\ubc0b\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.<\/strong><\/p>\n<pre><code class=\"language-bash\">kubectl -n argocd create secret generic repo-k8s-gitops-aws \\\n  --from-literal=type=git \\\n  --from-literal=url=https:\/\/github.com\/&lt;YOUR_ID&gt;\/k8s-gitops-aws.git \\\n  --from-literal=username=&lt;YOUR_ID&gt; \\\n  --from-literal=password=&lt;GITHUB_TOKEN&gt;\n\nkubectl -n argocd label secret repo-k8s-gitops-aws argocd.argoproj.io\/secret-type=repository<\/code><\/pre>\n<h3>4.4 \ub8e8\ud2b8 Application \uc801\uc6a9<\/h3>\n<pre><code class=\"language-bash\">kubectl apply -f bootstrap\/root-app.yaml<\/code><\/pre>\n<p>\uc7a0\uc2dc \ud6c4 \ubaa8\ub450 <code>Synced \/ Healthy<\/code> \uac00 \ub418\uba74 \uc644\ub8cc\uc785\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-bash\">kubectl -n argocd get applications\n------------------------------------\nNAME     SYNC STATUS   HEALTH STATUS\nargocd   Synced        Healthy\nnginx    Synced        Healthy\nroot     Synced        Healthy<\/code><\/pre>\n<h3>4.5 \uc811\uc18d \ud655\uc778<\/h3>\n<pre><code class=\"language-bash\"># ArgoCD \ucd08\uae30 \ube44\ubc00\ubc88\ud638 (\uc0ac\uc6a9\uc790: admin)\nkubectl -n argocd get secret argocd-initial-admin-secret \\\n  -o jsonpath=&quot;{.data.password}&quot; | base64 -d; echo<\/code><\/pre>\n<ul>\n<li>ArgoCD : <code>https:\/\/&lt;EC2_PUBLIC_IP&gt;:30443\/<\/code> (\uc790\uccb4 \uc11c\uba85 \uc778\uc99d\uc11c \uacbd\uace0\ub294 \ubb34\uc2dc)<\/li>\n<li>nginx : <code>http:\/\/&lt;EC2_PUBLIC_IP&gt;:31405\/<\/code><\/li>\n<\/ul>\n<blockquote>\n<p>\ub85c\uadf8\uc778 \ud6c4 <strong>User Info \u2192 Update Password<\/strong> \uc5d0\uc11c \ube44\ubc00\ubc88\ud638\ub97c \ubc14\uafb8\uace0,<br \/>\n<code>kubectl -n argocd delete secret argocd-initial-admin-secret<\/code> \uc73c\ub85c \ucd08\uae30 \ube44\ubc00\ubc88\ud638 Secret \uc744 \uc0ad\uc81c\ud569\ub2c8\ub2e4.<\/p>\n<\/blockquote>\n<hr \/>\n<h2>5. \uc6b4\uc601: \uc774\uc81c\ubd80\ud130\ub294 Git \ub9cc \uc218\uc815<\/h2>\n<p><strong>nginx \ub808\ud50c\ub9ac\uce74 \ubcc0\uacbd<\/strong><\/p>\n<pre><code class=\"language-bash\">vi values\/nginx\/values.yaml            # replicaCount: 3\ngit commit -am &quot;nginx replicas 3&quot;\ngit push<\/code><\/pre>\n<p><strong>push \uc804\uc5d0 \uacb0\uacfc \ubbf8\ub9ac \ubcf4\uae30<\/strong><\/p>\n<p>ArgoCD \uc640 \uac19\uc740 \ucc28\ud2b8 + \uac19\uc740 values \uc774\ubbc0\ub85c, \ub85c\uceec \uacb0\uacfc\uac00 \uadf8\ub300\ub85c \ubc30\ud3ec\ub429\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-bash\">helm template nginx charts\/nginx -f values\/nginx\/values.yaml<\/code><\/pre>\n<p><strong>ArgoCD \ubc84\uc804 \uc5c5\uadf8\ub808\uc774\ub4dc<\/strong><\/p>\n<pre><code class=\"language-bash\">vi apps\/argocd.yaml                    # targetRevision \ub9cc \ubcc0\uacbd\ngit commit -am &quot;argo-cd upgrade&quot;\ngit push<\/code><\/pre>\n<p>ArgoCD \ub294 \uae30\ubcf8 3\ubd84 \uc8fc\uae30\ub85c Git \uc744 \ud655\uc778\ud569\ub2c8\ub2e4. \ubc14\ub85c \ubc18\uc601\ud558\ub824\uba74 UI \uc5d0\uc11c <strong>Refresh<\/strong> \ub97c \ub204\ub985\ub2c8\ub2e4.<\/p>\n<p><strong>\uc8fc\uc758\uc0ac\ud56d<\/strong><\/p>\n<ul>\n<li><code>kubectl edit<\/code>, <code>kubectl scale<\/code> \ub85c \uc9c1\uc811 \uc218\uc815\ud558\uba74 <code>selfHeal<\/code> \uc774 \ub418\ub3cc\ub9bd\ub2c8\ub2e4.<\/li>\n<li>\uc124\uce58 \ud6c4 <code>helm upgrade argocd ...<\/code> \ub294 \uc0ac\uc6a9\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. \uc5c5\uadf8\ub808\uc774\ub4dc\ub294 <code>apps\/argocd.yaml<\/code> \ub85c \ud569\ub2c8\ub2e4.<\/li>\n<li>\ube44\ubc00\ubc88\ud638\u00b7\ud1a0\ud070 \uac19\uc740 \ube44\ubc00\uac12\uc740 Git \uc5d0 \ub123\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.<\/li>\n<\/ul>\n<hr \/>\n<h2>6. \uc815\ub9ac<\/h2>\n<table>\n<thead>\n<tr>\n<th>\ub2e8\uacc4<\/th>\n<th>\uc791\uc5c5<\/th>\n<th>\uc704\uce58<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>1<\/td>\n<td>EC2 \uc0dd\uc131, \ubcf4\uc548 \uadf8\ub8f9 \uc124\uc815<\/td>\n<td>AWS \ucf58\uc194<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>containerd + kubeadm \uc124\uce58, \ud074\ub7ec\uc2a4\ud130 \ucd08\uae30\ud654<\/td>\n<td>EC2<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>Git \uc800\uc7a5\uc18c \uc791\uc131 \ud6c4 push<\/td>\n<td>\ub85c\uceec PC<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td><code>helm install argocd<\/code> \u2192 \uc800\uc7a5\uc18c \ub4f1\ub85d \u2192 <code>root-app<\/code> \uc801\uc6a9<\/td>\n<td>EC2<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>\uc774\ud6c4 \ubcc0\uacbd\uc740 Git push \ub9cc<\/td>\n<td>\ub85c\uceec PC<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>EC2 \ub97c \uc0c8\ub85c \ub9cc\ub4e4\uc5b4\ub3c4 <strong>2\uc7a5 \u2192 4\uc7a5<\/strong>\ub9cc \ub2e4\uc2dc \ud558\uba74 \ub098\uba38\uc9c0\ub294 Git \uc5d0 \uc788\ub294 \uadf8\ub300\ub85c \ubcf5\uc6d0\ub429\ub2c8\ub2e4.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Kubernetes \u2013 AWS EC2 \ub2e8\uc77c \ub178\ub4dc\uc5d0 ArgoCD + nginx \uad6c\uc131\ud558\uae30 (GitOps, Private \uc800\uc7a5\uc18c) AWS EC2 \uc778\uc2a4\ud134\uc2a4 \ud55c \ub300\uc5d0 kubeadm \uc73c\ub85c \ucfe0\ubc84\ub124\ud2f0\uc2a4\ub97c \uc124\uce58\ud558\uace0, ArgoCD \uc640 nginx \ub9cc \uc62c\ub9ac\ub294 \ucd5c\uc18c \uad6c\uc131\uc785\ub2c8\ub2e4. \ubaa8\ub4e0 \uc124\uc815\uc740 GitHub Private \uc800\uc7a5\uc18c\uc5d0 \ub450\uace0, \ubc30\ud3ec\ub294 ArgoCD \uac00 Git \uc744 \ubcf4\uace0 \uc218\ud589\ud569\ub2c8\ub2e4. EC2 \ub294 \uba54\ubaa8\ub9ac\uac00 4GB \uc774\uc0c1\uc774\uc5b4\uc57c \ud558\uace0, \uc6b0\ubd84\ud22c OS \uc5ec\uc57c \ud569\ub2c8\ub2e4. \uc218\ub3d9\uc73c\ub85c \ud558\ub294 \uc791\uc5c5\uc740\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=12049\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-12049","post","type-post","status-publish","format-standard","hentry","category-devops"],"_links":{"self":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/12049","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12049"}],"version-history":[{"count":7,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/12049\/revisions"}],"predecessor-version":[{"id":12056,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/12049\/revisions\/12056"}],"wp:attachment":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12049"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12049"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12049"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}