Kubernetes namespace

 Namespace

Cluster start auto create following name space

1. Default namespace

2. Kube-system 

3. Kube-public


Use namespace to separate the environments

connect mysql

default namespace mysql.connect("db-service")

other namespace - dev mysql.connect("db-service.dev.svc.cluster.local"


 list pod

check default namespace #kubectl get pods

check other namespace #kubectl get pods --namespace=kube-system


Create pod

create in default namespace #kubectl create -f <yaml file>

create in other namespace #kubectl create -f <yaml file> --namespace =dev


Define namespace in the yaml file in metadata part

namespace: <namespace>


create namespace #kubectl create -f <yaml file>

switch namespace #kubectl config set-context $(kubectl config current-context) --namespace=<namespace>

check namespace list #kubectl get namespaces

check items in all namespace #kubectl get all --all-namespaces

https://github.com/tomshenhao/kubernetes-learning/blob/master/namespace.yml


Create resource quota in namespace


Create quota #kubectl create -f <yaml file>

Check quota #kubectl get quota

Remove quota #kubectl delete quota <quota name>

https://github.com/tomshenhao/kubernetes-learning/blob/master/namespace-quota.yaml


Comments

Popular posts from this blog

Nginx Proxy & Load Balance & LNMP

Snort+barnyard2+Snorby CentOS 6.5_64 Installation

ORACLE Error