Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

1-

...

Create a POD on Kubernites

2- Create containers


1- Create a POD on kubernetes:

kubectl create -f redis-salve-controller.json -n frontend 

#kubectl delete -f redis-salve-controller.json -n frontend



[root@5b3s27 development]# kubectl get pods -n frontend
NAME READY STATUS RESTARTS AGE
redis-slave-4c2g2 1/1 Running 0 5m
redis-slave-rmzgh 1/1 Running 0 5m


[root@5b3s27 development]# kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
frontend redis-slave-4c2g2 1/1 Running 0 4m
frontend redis-slave-rmzgh 1/1 Running 0 4m
kube-system etcd-5b3s27 1/1 Running 2 3d
kube-system kube-apiserver-5b3s27 1/1 Running 2 3d
kube-system kube-controller-manager-5b3s27 1/1 Running 3 3d
kube-system kube-dns-2147521494-mqtqm 3/3 Running 3 11h
kube-system kube-proxy-6cz57 1/1 Running 3 3d
kube-system kube-scheduler-5b3s27 1/1 Running 3 3d
kube-system kubernetes-dashboard-890007748-36c76 1/1 Running 2 2d


[root@5b3s27 development]# kubectl get ns
NAME STATUS AGE
backend Active 10h
default Active 3d
development Active 10h
frontend Active 10h
kube-public Active 3d
kube-system Active 3d
qa Active 10h



[root@5b3s27 development]# more frontend-ns.yaml
apiVersion: v1
kind: Namespace
metadata:
labels:
ns: frontend
name: frontend
annotations:
net.beta.kubernetes.io/network-policy: |
{
"ingress": {
"isolation": "DefaultDeny"
}
}




[root@5b3s27 development]# more redis-slave-controller.json
{
"kind":"ReplicationController",
"apiVersion":"v1",
"metadata":{
"name":"redis-slave",
"labels":{
"role":"slave"
}
},
"spec":{
"replicas":2,
"selector":{
"app":"redis",
"role":"slave"
},
"template":{
"metadata":{
"labels":{
"app":"redis",
"role":"slave",
"name":"redis"
}
},
"spec":{
"containers":[
{
"name":"redis-slave",
"image":"kubernetes/redis-slave:v2",
"ports":[
{
"containerPort":6379
}
]
}
]
}
}
}
}