[kubernetes 수업] 05장 Architecture 관련
오후 1:01 2024-11-02 
================================== 
node: 파드가 생성되는 시스템 
Control Plane: api 서버 역할 
================================== 
오후 2:11 2024-11-02 
[root@master ~/kube/05/namespace]# kubectl describe pod -n myns2 web2-pod 
================================== 
오후 2:18 2024-11-02 
apiVersion: v1 
kind: Namespace 
metadata: 
  name: myns4 
--- 
apiVersion: v1 
kind: Pod 
metadata: 
  name: web4-pod 
  namespace: myns4 
spec: 
  containers: 
  - image: nginx 
    name: nginx 
    ports: 
    - containerPort: 80 
      protocol: TCP 
================================== 
오후 2:22 2024-11-02 
[root@master ~/kube/05/namespace]# kubectl config view 
apiVersion: v1 
clusters: 
- cluster: 
    certificate-authority-data: DATA+OMITTED 
    server: https://127.0.0.1:6443 
  name: cluster.local 
contexts: 
- context: 
    cluster: cluster.local 
    user: kubernetes-admin 
  name: kubernetes-admin@cluster.local 
current-context: kubernetes-admin@cluster.local 
kind: Config 
preferences: {} 
users: 
- name: kubernetes-admin 
  user: 
    client-certificate-data: DATA+OMITTED 
    client-key-data: DATA+OMITTED 
================================== 
kubectl config set-context bestchoco-user@cluster.local \ 
--cluster=cluster.local --user=kubernetes-admin \ 
--namespace=myns5 
================================== 
오후 2:29 2024-11-02 
[root@master ~/kube/05/namespace]# kubectl config current-context 
kubernetes-admin@cluster.local 
[root@master ~/kube/05/namespace]# kubectl config use-context bestchoco-user@cluster.local 
Switched to context "bestchoco-user@cluster.local". 
[root@master ~/kube/05/namespace]# kubectl config current-context 
bestchoco-user@cluster.local 
================================== 
오후 2:31 2024-11-02 
[root@master ~/kube/05/namespace]# kubectl run web5-pod --image=nginx --port 80 
pod/web5-pod created 
[root@master ~/kube/05/namespace]# kubectl get pod 
NAME       READY   STATUS              RESTARTS   AGE 
web5-pod   0/1     ContainerCreating   0          16s 
[root@master ~/kube/05/namespace]# kubectl get pod -n default 
NAME       READY   STATUS    RESTARTS   AGE 
web1-pod   1/1     Running   0          39m 
================================== 
오후 2:37 2024-11-02 
kubectl delete web5-pod -n myns5 
================================== 
오후 2:37 2024-11-02 
[root@master ~/kube/05/namespace]# kubectl delete namespaces myns5 
namespace "myns5" deleted 
================================== 
오후 2:39 2024-11-02 
[root@master ~/kube/05/namespace]# kubectl get namespaces 
NAME              STATUS   AGE 
default           Active   6h41m 
kube-node-lease   Active   6h41m 
kube-public       Active   6h41m 
kube-system       Active   6h41m 
myns1             Active   45m 
myns2             Active   43m 
myns3             Active   26m 
[root@master ~/kube/05/namespace]# kubectl delete namespaces myns1 myns2 myns3 
namespace "myns1" deleted 
namespace "myns2" deleted 
namespace "myns3" deleted 
================================== 
오후 3:10 2024-11-02 
kubectl create namespace nginx-ns 
kubectl run nginx-web1 --image=nginx --port 80 -n nginx-ns 
 kubectl run nginx-web2 --image=nginx --port 80 -n nginx-ns  
kubectl run nginx-web3 --image=nginx --port 80 -n nginx-ns 
[root@master ~/kube/05/namespace]# kubectl get pod -n nginx-ns 
NAME         READY   STATUS    RESTARTS   AGE 
nginx-web1   1/1     Running   0          3m29s 
nginx-web2   1/1     Running   0          2m58s 
nginx-web3   1/1     Running   0          2m53s 
================================== 
kubectl create -f test.yml 
apiVersion: v1 
kind: Namespace 
metadata: 
  name: httpd-ns 
--- 
apiVersion: v1 
kind: Pod 
metadata: 
  name: httpd-web1 
  namespace: httpd-ns 
spec: 
  containers: 
  - image: httpd 
    name: httpd-web1 
    ports: 
    - containerPort: 80 
      protocol: TCP 
--- 
apiVersion: v1 
kind: Pod 
metadata: 
  name: httpd-web2 
  namespace: httpd-ns 
spec: 
  containers: 
  - image: httpd 
    name: httpd-web2 
    ports: 
    - containerPort: 80 
      protocol: TCP 
--- 
apiVersion: v1 
kind: Pod 
metadata: 
  name: httpd-web3 
  namespace: httpd-ns 
spec: 
  containers: 
  - image: httpd 
    name: httpd-web3 
    ports: 
    - containerPort: 80 
      protocol: TCP 
================================== 
[root@master ~/kube/05/namespace]# kubectl create -f test.yml 
namespace/httpd-ns created 
pod/httpd-web1 created 
pod/httpd-web2 created 
[root@master ~/kube/05/namespace]# kubectl get pod -n httpd-ns 
NAME         READY   STATUS    RESTARTS   AGE 
httpd-web1   1/1     Running   0          47s 
httpd-web2   1/1     Running   0          46s 
httpd-web3   1/1     Running   0          46s 
================================= 
오후 3:14 2024-11-02 
kubectl delete namespaces nginx-ns httpd-ns