"Kubectl expose"의 두 판 사이의 차이

15번째 줄: 15번째 줄:
kubernetes            ClusterIP  10.96.0.1      <none>        443/TCP          22s
kubernetes            ClusterIP  10.96.0.1      <none>        443/TCP          22s
kubernetes-bootcamp  NodePort    10.100.84.34  <none>        8080:31392/TCP  5s
kubernetes-bootcamp  NodePort    10.100.84.34  <none>        8080:31392/TCP  5s
</source>
==실습==
<source lang='console'>
master:~$ kubectl create deployment nginx --image=nginx
deployment.apps/nginx created
</source>
<source lang='console'>
master:~$ kubectl get all -l app=nginx
NAME                        READY  STATUS    RESTARTS  AGE
pod/nginx-65f88748fd-77jm4  1/1    Running  0          16s
NAME                    READY  UP-TO-DATE  AVAILABLE  AGE
deployment.apps/nginx  1/1    1            1          16s
NAME                              DESIRED  CURRENT  READY  AGE
replicaset.apps/nginx-65f88748fd  1        1        1      16s
</source>
<source lang='console'>
master:~$ kubectl expose deployment nginx
error: couldn't find port via --port flag or introspection
See 'kubectl expose -h' for help and examples
</source>
<source lang='console'>
master:~$ kubectl expose deployment nginx
error: couldn't find port via --port flag or introspection
See 'kubectl expose -h' for help and examples
</source>
</source>



2019년 5월 28일 (화) 10:43 판

1 개요

kubectl expose
$ kubectl get services
NAME         TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP   15s
$ kubectl expose deployment/kubernetes-bootcamp --type="NodePort" --port 8080
service "kubernetes-bootcamp" exposed
$ kubectl get services
NAME                  TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
kubernetes            ClusterIP   10.96.0.1      <none>        443/TCP          22s
kubernetes-bootcamp   NodePort    10.100.84.34   <none>        8080:31392/TCP   5s

2 실습

master:~$ kubectl create deployment nginx --image=nginx
deployment.apps/nginx created
master:~$ kubectl get all -l app=nginx
NAME                         READY   STATUS    RESTARTS   AGE
pod/nginx-65f88748fd-77jm4   1/1     Running   0          16s

NAME                    READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/nginx   1/1     1            1           16s

NAME                               DESIRED   CURRENT   READY   AGE
replicaset.apps/nginx-65f88748fd   1         1         1       16s
master:~$ kubectl expose deployment nginx 
error: couldn't find port via --port flag or introspection
See 'kubectl expose -h' for help and examples
master:~$ kubectl expose deployment nginx 
error: couldn't find port via --port flag or introspection
See 'kubectl expose -h' for help and examples

3 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}