namespace资源名称空间

    删除namespace资源会级联删除其所包含的所有其它资源对象
    名称空间仅仅只是用来限制资源名称的作用域      并不能实现Pod的通信隔离

在名称空间下操作service 实现service资源隔离
 [root@k8s-master ~]# kubectl create service nodeport my-ns --tcp=5678:8080 -n qa
service/my-ns created
[root@k8s-master ~]# kubectl get svc
NAME         TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
kubernetes   ClusterIP   10.96.0.1        <none>        443/TCP        231d
myapp        NodePort    10.100.165.177   <none>        80:32185/TCP   21h
[root@k8s-master ~]# kubectl get svc -n default
NAME         TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
kubernetes   ClusterIP   10.96.0.1        <none>        443/TCP        231d
myapp        NodePort    10.100.165.177   <none>        80:32185/TCP   21h
[root@k8s-master ~]# kubectl get svc -n qa
NAME      TYPE       CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
my-ns     NodePort   10.102.116.9   <none>        5678:30170/TCP   24s

[root@k8s-master ~]# kubectl delete svc my-ns
Error from server (NotFound): services "my-ns" not found
[root@k8s-master ~]# kubectl delete svc my-ns -n qa
service "my-ns" deleted
[root@k8s-master ~]# kubectl delete all --all -n qa
service "my-ns" deleted
名称空间

相关文章:

  • 2022-12-23
  • 2021-11-05
  • 2022-03-07
  • 2021-05-09
  • 2022-12-23
  • 2021-10-12
  • 2021-12-25
  • 2022-01-07
猜你喜欢
  • 2021-11-12
  • 2021-08-09
  • 2021-09-08
  • 2022-12-23
  • 2022-02-16
  • 2021-12-17
  • 2022-12-23
相关资源
相似解决方案