{"id":5490,"date":"2026-04-29T08:35:58","date_gmt":"2026-04-28T23:35:58","guid":{"rendered":"https:\/\/www.freelifemakers.org\/wordpress\/?p=5490"},"modified":"2026-04-29T11:04:40","modified_gmt":"2026-04-29T02:04:40","slug":"kubernetes-docker-desktop-multinodes-service","status":"publish","type":"post","link":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/2026\/04\/29\/kubernetes-docker-desktop-multinodes-service\/","title":{"rendered":"[Kubernetes]Docker Desktop+MultiNodes +Service[MacOS]"},"content":{"rendered":"\n<p>\ud83d\udc49\ud83c\udffb \uc774\uc804 \uac8c\uc2dc\ubb3c\uc5d0\uc11c \ub864\ub9c1 \uc5c5\ub370\uc774\ud2b8\ub098 \uc2a4\ucf00\uc77c\ub9c1\uc5d0 \ub300\ud574\uc11c \uc0b4\ud3b4\ubd24\uc2b5\ub2c8\ub2e4.<br>In the previous post, we looked at rolling updates and scaling.<\/p>\n\n\n\n<p>\ud83d\udc49\ud83c\udffb \uc774\uc804 \uac8c\uc2dc\ubb3c\uc5d0\uc11c \uc0ac\uc6a9\ud588\ub358 \uc14b\ud305\uc5d0 \ucd94\uac00\ub85c service\ub97c \ucd94\uac00\ud574\ubcf4\uaca0\uc2b5\ub2c8\ub2e4.<br>Let&#8217;s add a service to the settings used in the previous post.<\/p>\n\n\n\n<p>\ud83d\udc49\ud83c\udffb \ucfe0\ubc84\ub124\ud2f0\uc2a4\ub97c \uc678\ubd80\uc5d0 \uc774\uc804\ucc98\ub7fc(port-forward) \uc678\ubd80\uc5d0 \ub178\ucd9c\ud560 \uacbd\uc6b0 \ucfe0\ubc84\ub124\ud2f0\uc2a4 \ub0b4\ubd80\uc5d0\uc11c \ub85c\ub4dc\ubc38\ub7f0\uc2f1\uc774 \uc791\ub3d9\ud558\uc9c0 \uc54a\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<br>If you expose Kubernetes externally as before (port-forward), load balancing within Kubernetes may not work.<\/p>\n\n\n\n<p>\ud83d\udc49\ud83c\udffb port-forward\ub97c \uc0ac\uc6a9\ud558\ub294\uacbd\uc6b0 \ud14c\uc2a4\ud2b8\uc5d0\ub294 \uc801\ud569\ud558\uc9c0\ub9cc \uc678\ubd80\uc5d0\uc11c \uc811\uc18d\uc2dc \ucc98\uc74c \uc811\uc18d\ud55c \ud30c\ub4dc\uc5d0 \uc811\uc18d\uc774 \uace0\uc815\ub429\ub2c8\ub2e4.<br>Using port-forward is suitable for testing, but when accessing from outside, the connection is fixed to the first connected pod.<\/p>\n\n\n\n<p>\u2714\ufe0f port-forward\ub97c \uc0ac\uc6a9\ud574\uc11c \uc678\ubd80\uc5d0 \ub178\ucd9c\ud55c\uacbd\uc6b0<br>When exposed externally using port-forward<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>MacBookAir nginx-test1 % kubectl port-forward svc\/nginx-deployment 8080:80\nForwarding from 127.0.0.1:8080 -&gt; 80\nForwarding from &#91;::1]:8080 -&gt; 80<\/code><\/pre>\n\n\n\n<p>\ud83d\udc49\ud83c\udffb \uadf8\ub798\uc11c \ucfe0\ubc84\ub124\ud2f0\uc2a4 \ub0b4\ubd80\uc5d0\uc11c \ub85c\ub4dc\ubc38\ub7f0\uc2f1\uc774 \uc791\ub3d9\ud558\uac8c \ud558\ub824\uba74 \uc11c\ube44\uc2a4\ub97c \uc0ac\uc6a9\ud574\uc57c\ud569\ub2c8\ub2e4.<br>Therefore, to enable load balancing within Kubernetes, you must use a service.<\/p>\n\n\n\n<p>\u2714\ufe0f nginx-service.yaml<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apiVersion: v1\nkind: Service\nmetadata:\n  name: nginx-service\nspec:\n  selector:\n    app: nginx\n  type: NodePort\n  ports:\n    - port: 80\n      targetPort: 80\n      nodePort: 30080   # 30000~32767\n      protocol: TCP\n<\/code><\/pre>\n\n\n\n<p>&#8212; yaml\ud30c\uc77c \uc801\uc6a9 \/ Apply YAML file<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>kubectl apply -f nginx-service.yaml<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\ud83d\udc49\ud83c\udffb \uc2e4\uc81c \uc791\uc5c5 \/ actual work<\/p>\n\n\n\n<p>\u2714\ufe0f \ub3d9\uc77c\ud55c \ub514\ub809\ud1a0\ub9ac \ub0b4\uc5d0 nginx-deployment.yaml\uacfc nginx-service.yaml\ud30c\uc77c\uc744 \uc900\ube44\ud569\ub2c8\ub2e4.<br>Prepare the nginx-deployment.yaml and nginx-service.yaml files in the same directory.<\/p>\n\n\n\n<p>\u2714\ufe0f nginx-deployment.yaml ( \ubc14\ub85c \uc774\uc804\uacfc \ub3d9\uc77c\ud55c \ub0b4\uc6a9 \/ The exact same content as before)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apiVersion: apps\/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:latest\n        ports:\n        - containerPort: 80\n<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f nginx-service.yaml (\uc0c8\ub85c \ucd94\uac00\ud55c \ub0b4\uc6a9)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apiVersion: v1\nkind: Service\nmetadata:\n  name: nginx-service\nspec:\n  selector:\n    app: nginx\n  type: NodePort\n  ports:\n    - port: 80\n      targetPort: 80\n      nodePort: 30080   # 30000~32767\n      protocol: TCP\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>nginx-test1 % ls\nnginx-deployment.yaml\tnginx-service.yaml\t<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f \ub3c4\ucee4\ub370\uc2a4\ud06c\ud0d1\uc744 \uc2e4\ud589\ud558\uace0 \ud130\ubbf8\uc5bc\uc5d0\uc11c yaml\ud30c\uc77c\uc744 \uc2e4\ud589\ud569\ub2c8\ub2e4.<br>Run Docker Desktop and execute the yaml file in the terminal.<\/p>\n\n\n\n<p>\u2714\ufe0f \ub514\ub809\ud1a0\ub9ac \ub0b4\uc758 \ud30c\uc77c\uc744 \ud55c\ubc88\uc5d0 \uc801\uc6a9\ud558\ub824\uba74 \uc544\ub798\ucc98\ub7fc \ud558\uba74\ub429\ub2c8\ub2e4.<br>To apply the files in the directory all at once, do as follows.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>acBookAir nginx-test1 % <strong>kubectl apply -f .<\/strong>\ndeployment.apps\/nginx-deployment created\nservice\/nginx-service created\nMacBookAir nginx-test1 % <\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f \ub9cc\uc57d\uc5d0 \uc774\ubbf8\uc9c0\uac00 \uc5c6\uc73c\uba74 magePullBackOff\uac00 \ub098\ud0c0\ub0a9\ub2c8\ub2e4.<br>If there is no image, ImagePullBackOff appears .<\/p>\n\n\n\n<p>\u2714\ufe0f \uc774\ub7f4 \uacbd\uc6b0 \uc774\ubbf8\uc9c0\ub97c \ub2e4\uc2dc \ub2e4\uc6b4 \ubc1b\uace0 \uc124\uc815\uc744 \uc7ac\uc801\uc6a9\ud569\ub2c8\ub2e4.<br>In this case, download the image again and reapply the settings.<\/p>\n\n\n\n<p>\u2714\ufe0f nginx:latest\uc774\ubbf8\uc9c0 \ub2e4\uc6b4\ub85c\ub4dc \/ nginx:latest image download<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker pull nginx:latest<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f \uc124\uc815 \uc7ac\uc801\uc6a9 \/ Reapply settings<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># kubectl rollout restart deployment\/&#91;\ub514\ud50c\ub85c\uc774\uba3c\ud2b8\uba85 \/ Deployment Name]\n\nMacBookAir nginx-test1 % <strong>kubectl rollout restart deployment\/nginx-deployment <\/strong>\ndeployment.apps\/nginx-deployment restarted\nMacBookAir nginx-test1 % <\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f pod\uc0c1\ud0dc \ud655\uc778 \/ Check pod status<\/p>\n\n\n\n<p>&#8212; STATUS\uac00 Running \uc73c\ub85c \ubc14\ub010\uac78 \ubcfc \uc218 \uc788\uc2b5\ub2c8\ub2e4.<br>You can see that STATUS has changed to Running.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>MacBookAir nginx-test1 % kubectl get pod\nNAME                                READY   STATUS    RESTARTS   AGE\nnginx-deployment-6f9664446b-72mlp   1\/1     Running   0          10m\nnginx-deployment-6f9664446b-g2b4x   1\/1     Running   0          10m\nnginx-deployment-6f9664446b-xrqhr   1\/1     Running   0          10m\nMacBookAir nginx-test1 % \n<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f \uc11c\ube44\uc2a4 \uc0c1\ud0dc\ud655\uc778 \/ Check service status<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># kubectl get service or kubectl get svc\n\nMacBookAir nginx-test1 % kubectl get service\nNAME            TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)        AGE\nkubernetes      ClusterIP   10.96.0.1      &lt;none&gt;        443\/TCP        16h\nnginx-service   NodePort    10.96.157.81   &lt;none&gt;        80:<strong>30080<\/strong>\/TCP   13m\n<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f \ube0c\ub77c\uc6b0\uc800\uc811\uc18d \/ Browser access<\/p>\n\n\n\n<p>&#8212; \ube0c\ub77c\uc6b0\uc800\uc5d0\uc11c 30080\ud3ec\ud2b8\ub85c \uc811\uc18d\ud569\ub2c8\ub2e4.<br>Connect to port 30080 in your browser.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>http:&#47;&#47;localhost:30080<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\ud83d\udc49\ud83c\udffb \uc774\uc804 \uac8c\uc2dc\ubb3c\uc5d0\uc11c \ub864\ub9c1 \uc5c5\ub370\uc774\ud2b8\ub098 \uc2a4\ucf00\uc77c\ub9c1\uc5d0 \ub300\ud574\uc11c \uc0b4\ud3b4\ubd24\uc2b5\ub2c8\ub2e4.In the previous post, we looked at rolling updates and scaling. \ud83d\udc49\ud83c\udffb \uc774\uc804 \uac8c\uc2dc\ubb3c\uc5d0\uc11c \uc0ac\uc6a9\ud588\ub358 \uc14b\ud305\uc5d0 \ucd94\uac00\ub85c service\ub97c \ucd94\uac00\ud574\ubcf4\uaca0\uc2b5\ub2c8\ub2e4.Let&#8217;s add a service to the settings used in the previous post. \ud83d\udc49\ud83c\udffb \ucfe0\ubc84\ub124\ud2f0\uc2a4\ub97c \uc678\ubd80\uc5d0 \uc774\uc804\ucc98\ub7fc(port-forward) \uc678\ubd80\uc5d0 \ub178\ucd9c\ud560 \uacbd\uc6b0 \ucfe0\ubc84\ub124\ud2f0\uc2a4 \ub0b4\ubd80\uc5d0\uc11c \ub85c\ub4dc\ubc38\ub7f0\uc2f1\uc774 \uc791\ub3d9\ud558\uc9c0 \uc54a\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4.If you expose Kubernetes externally [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,24,1],"tags":[],"class_list":["post-5490","post","type-post","status-publish","format-standard","hentry","category-cpp","category-kubernetes","category-uncategorized","missing-thumbnail"],"_links":{"self":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/5490","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=5490"}],"version-history":[{"count":44,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/5490\/revisions"}],"predecessor-version":[{"id":5541,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/5490\/revisions\/5541"}],"wp:attachment":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=5490"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=5490"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=5490"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}