Mais conteúdo relacionado Semelhante a Kubernetes: Wie Chefkoch.de mit Containern arbeitet (20) Mais de Per Bernhardt (11) Kubernetes: Wie Chefkoch.de mit Containern arbeitet2. Mein Name ist Per
http://perprogramming.de
Ich bin ein Chefkoch
http://www.chefkoch.de
45. core@core-01 ~ $ kubectl --server=https://core01.fra.chefkoch.net:6443 get nodes
NAME LABELS STATUS
10.10.0.100 kubernetes.io/hostname=10.10.0.100,name=core01.cgn Ready
10.10.0.101 kubernetes.io/hostname=10.10.0.101,name=core01.fra Ready
10.10.0.102 kubernetes.io/hostname=10.10.0.102,name=core02.fra Ready
10.10.0.104 kubernetes.io/hostname=10.10.0.104,name=core03.fra Ready
10.10.0.105 kubernetes.io/hostname=10.10.0.105,name=bigdata02.fra Ready
10.10.0.106 kubernetes.io/hostname=10.10.0.106,name=bigdata01.cgn Ready
10.10.0.107 kubernetes.io/hostname=10.10.0.107,name=bigdata01.fra Ready
10.10.0.108 kubernetes.io/hostname=10.10.0.108,name=core06.fra Ready
10.10.0.109 kubernetes.io/hostname=10.10.0.109,name=core05.fra Ready
10.10.0.110 kubernetes.io/hostname=10.10.0.110,name=core04.fra Ready
47. core@core-01 ~ $ kubectl get namespaces
NAME LABELS STATUS
default <none> Active
48. core@core-01 ~ $ kubectl get namespaces
NAME LABELS STATUS
default <none> Active
core@core-01 ~ $ kubectl --namespace=default get all
CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS
NAME LABELS SELECTOR IP(S) PORT(S)
NAME READY STATUS RESTARTS AGE
NAME LABELS STATUS VOLUME
49. core@core-01 ~ $ kubectl config view
apiVersion: v1
kind: Config
clusters:
- name: production
cluster:
server: https://core01.fra.chefkoch.net:6443
contexts:
- name: foobar.production
context:
cluster: production
namespace: foobar
user: john.doe
users:
- name: john.doe
user:
username: john.doe
password: p4ssw0rd
current-context: ""
50. core@core-01 ~ $ kubectl config view
apiVersion: v1
kind: Config
clusters:
- name: production
cluster:
server: https://core01.fra.chefkoch.net:6443
contexts:
- name: foobar.production
context:
cluster: production
namespace: foobar
user: john.doe
users:
- name: john.doe
user:
username: john.doe
password: p4ssw0rd
current-context: ""
core@core-01 ~ $ kubectl --context=foobar.production get all
51. core@core-01 ~ $ kubectl config view
apiVersion: v1
kind: Config
clusters:
- name: production
cluster:
server: https://core01.fra.chefkoch.net:6443
contexts:
- name: foobar.production
context:
cluster: production
namespace: foobar
user: john.doe
users:
- name: john.doe
user:
username: john.doe
password: p4ssw0rd
current-context: ""
core@core-01 ~ $ kubectl --context=foobar.production get all
core@core-01 ~ $ kubectl --cluster=production get all
52. core@core-01 ~ $ kubectl config view
apiVersion: v1
kind: Config
clusters:
- name: production
cluster:
server: https://core01.fra.chefkoch.net:6443
contexts:
- name: foobar.production
context:
cluster: production
namespace: foobar
user: john.doe
users:
- name: john.doe
user:
username: john.doe
password: p4ssw0rd
current-context: ""
core@core-01 ~ $ kubectl --context=foobar.production get all
core@core-01 ~ $ kubectl --cluster=production get all
core@core-01 ~ $ kubectl --username=john.doe --password=p4ssw0rd get all
53. core@core-01 ~ $ kubectl config view
apiVersion: v1
kind: Config
clusters:
- name: production
cluster:
server: https://core01.fra.chefkoch.net:6443
contexts:
- name: foobar.production
context:
cluster: production
namespace: foobar
user: john.doe
users:
- name: john.doe
user:
username: john.doe
password: p4ssw0rd
current-context: ""
core@core-01 ~ $ kubectl config use-context foobar.production
core@core-01 ~ $ kubectl --context=foobar.production get all
core@core-01 ~ $ kubectl --cluster=production get all
core@core-01 ~ $ kubectl --username=john.doe --password=p4ssw0rd get all
55. apiVersion: v1
kind: Pod
metadata:
name: my-symfony-app
labels:
name: my-symfony-app
spec:
containers:
- name: nginx
image: my-symfony-app
command: [nginx]
volumeMounts:
- {name: socket, mountPath: /run}
- name: php-fpm
image: my-symfony-app
command: [php5-fpm]
volumeMounts:
- {name: socket, mountPath: /run}
volumes:
- {name: socket, emptyDir: {medium: Memory}}
my-symfony-app.yml
57. core@core-01 ~ $ kubectl get pods
NAME READY STATUS RESTARTS AGE
my-symfony-app 2/2 Running 0 2s
core@core-01 ~ $ kubectl create -f my-symfony-app.yml
58. core@core-01 ~ $ kubectl get pods
NAME READY STATUS RESTARTS AGE
my-symfony-app 2/2 Running 0 2s
core@core-01 ~ $ kubectl create -f my-symfony-app.yml
core@core-01 ~ $ kubectl logs my-symfony-app -c php-fpm
[15-Oct-2015 15:29:45] NOTICE: fpm is running, pid 1
[15-Oct-2015 15:29:45] NOTICE: ready to handle connections
59. core@core-01 ~ $ kubectl get pods
NAME READY STATUS RESTARTS AGE
my-symfony-app 2/2 Running 0 2s
core@core-01 ~ $ kubectl create -f my-symfony-app.yml
core@core-01 ~ $ kubectl delete pod my-symfony-app
core@core-01 ~ $ kubectl logs my-symfony-app -c php-fpm
[15-Oct-2015 15:29:45] NOTICE: fpm is running, pid 1
[15-Oct-2015 15:29:45] NOTICE: ready to handle connections
60. core@core-01 ~ $ kubectl get pods
NAME READY STATUS RESTARTS AGE
my-symfony-app 2/2 Running 0 2s
core@core-01 ~ $ kubectl create -f my-symfony-app.yml
core@core-01 ~ $ kubectl delete pod my-symfony-app
core@core-01 ~ $ kubectl get pods
NAME READY STATUS RESTARTS AGE
core@core-01 ~ $ kubectl logs my-symfony-app -c php-fpm
[15-Oct-2015 15:29:45] NOTICE: fpm is running, pid 1
[15-Oct-2015 15:29:45] NOTICE: ready to handle connections
68. Features, Features, Features!
• Readiness-Probe, Liveness-Probe
• Livecycle-Hooks
• ImagePull-Policy
• Ressourcen-Limits
• Verschiedene Mounts
• GCE
• AWS EBS
69. Features, Features, Features!
• Readiness-Probe, Liveness-Probe
• Livecycle-Hooks
• ImagePull-Policy
• Ressourcen-Limits
• Verschiedene Mounts
• GCE
• AWS EBS
• iSCSI
70. Features, Features, Features!
• Readiness-Probe, Liveness-Probe
• Livecycle-Hooks
• ImagePull-Policy
• Ressourcen-Limits
• Verschiedene Mounts
• GCE
• AWS EBS
• iSCSI
• NFS
71. Features, Features, Features!
• Readiness-Probe, Liveness-Probe
• Livecycle-Hooks
• ImagePull-Policy
• Ressourcen-Limits
• Verschiedene Mounts
• GCE
• AWS EBS
• iSCSI
• NFS
• Glusterfs
72. Features, Features, Features!
• Readiness-Probe, Liveness-Probe
• Livecycle-Hooks
• ImagePull-Policy
• Ressourcen-Limits
• Verschiedene Mounts
• GCE
• AWS EBS
• iSCSI
• NFS
• Glusterfs
• Git-Repo
76. core@core-01 ~ $ kubectl get pods
NAME READY STATUS RESTARTS AGE
my-symfony-app-jzd97 2/2 Running 0 2s
my-symfony-app-193aw 2/2 Running 0 2s
my-symfony-app-bicex 2/2 Running 0 2s
my-symfony-app-r2in0 2/2 Running 0 2s
my-symfony-app-lbo54 2/2 Running 0 2s
core@core-01 ~ $ kubectl create -f my-symfony-app-rc.yml
77. core@core-01 ~ $ kubectl get pods
NAME READY STATUS RESTARTS AGE
my-symfony-app-jzd97 2/2 Running 0 2s
my-symfony-app-193aw 2/2 Running 0 2s
my-symfony-app-bicex 2/2 Running 0 2s
my-symfony-app-r2in0 2/2 Running 0 2s
my-symfony-app-lbo54 2/2 Running 0 2s
core@core-01 ~ $ kubectl create -f my-symfony-app-rc.yml
core@core-01 ~ $ kubectl delete pods --all
78. core@core-01 ~ $ kubectl get pods
NAME READY STATUS RESTARTS AGE
my-symfony-app-jzd97 2/2 Running 0 2s
my-symfony-app-193aw 2/2 Running 0 2s
my-symfony-app-bicex 2/2 Running 0 2s
my-symfony-app-r2in0 2/2 Running 0 2s
my-symfony-app-lbo54 2/2 Running 0 2s
core@core-01 ~ $ kubectl create -f my-symfony-app-rc.yml
core@core-01 ~ $ kubectl delete pods --all
core@core-01 ~ $ kubectl get pods
NAME READY STATUS RESTARTS AGE
my-symfony-app-9tbfb 2/2 Running 0 2s
my-symfony-app-ui6yv 2/2 Running 0 2s
my-symfony-app-cx9te 2/2 Running 0 2s
my-symfony-app-ui6yv 2/2 Running 0 2s
my-symfony-app-tgquh 2/2 Running 0 2s
79. core@core-01 ~ $ kubectl get pods
NAME READY STATUS RESTARTS AGE
my-symfony-app-jzd97 2/2 Running 0 2s
my-symfony-app-193aw 2/2 Running 0 2s
my-symfony-app-bicex 2/2 Running 0 2s
my-symfony-app-r2in0 2/2 Running 0 2s
my-symfony-app-lbo54 2/2 Running 0 2s
core@core-01 ~ $ kubectl create -f my-symfony-app-rc.yml
core@core-01 ~ $ kubectl delete pods --all
core@core-01 ~ $ kubectl get pods
NAME READY STATUS RESTARTS AGE
my-symfony-app-9tbfb 2/2 Running 0 2s
my-symfony-app-ui6yv 2/2 Running 0 2s
my-symfony-app-cx9te 2/2 Running 0 2s
my-symfony-app-ui6yv 2/2 Running 0 2s
my-symfony-app-tgquh 2/2 Running 0 2s
core@core-01 ~ $ kubectl scale --replicas=2 rc my-symfony-app
80. core@core-01 ~ $ kubectl get pods
NAME READY STATUS RESTARTS AGE
my-symfony-app-jzd97 2/2 Running 0 2s
my-symfony-app-193aw 2/2 Running 0 2s
my-symfony-app-bicex 2/2 Running 0 2s
my-symfony-app-r2in0 2/2 Running 0 2s
my-symfony-app-lbo54 2/2 Running 0 2s
core@core-01 ~ $ kubectl create -f my-symfony-app-rc.yml
core@core-01 ~ $ kubectl delete pods --all
core@core-01 ~ $ kubectl get pods
NAME READY STATUS RESTARTS AGE
my-symfony-app-9tbfb 2/2 Running 0 2s
my-symfony-app-ui6yv 2/2 Running 0 2s
my-symfony-app-cx9te 2/2 Running 0 2s
my-symfony-app-ui6yv 2/2 Running 0 2s
my-symfony-app-tgquh 2/2 Running 0 2s
core@core-01 ~ $ kubectl scale --replicas=2 rc my-symfony-app
core@core-01 ~ $ kubectl get pods
NAME READY STATUS RESTARTS AGE
my-symfony-app-9tbfb 2/2 Running 0 10s
my-symfony-app-ui6yv 2/2 Running 0 10s
88. core@core-01 ~ $ kubectl get services
NAME LABELS SELECTOR IP(S) PORT(S)
my-symfony-app name=my-symfony-app name=my-symfony-app 80/TCP
core@core-01 ~ $ kubectl create -f my-symfony-app-svc.yml
89. core@core-01 ~ $ kubectl get services
NAME LABELS SELECTOR IP(S) PORT(S)
my-symfony-app name=my-symfony-app name=my-symfony-app 80/TCP
core@core-01 ~ $ kubectl create -f my-symfony-app-svc.yml
core@core-01 ~ $ kubectl exec -ti my-symfony-app -c nginx bash
root@my-symfony-app:/# curl -I my-symfony-app
HTTP/1.1 200 OK
Server: nginx/1.9.3 (Ubuntu)
Date: Fri, 16 Oct 2015 06:46:35 GMT
Content-Type: text/html
Content-Length: 177
Connection: keep-alive
108. Bugs, Bugs, Bugs…
• Namespace-Isolation
• Concurrent-Pull
• Orphan-Pull
• Exec-Timeout
• …