k8s学习小记

2019-07-28  本文已影响0人  FredricZhu

1.Kubectl创建Deployment的过程


image.png
kubectl run nginx-deployment --image=nginx:1.7.9 --replicas=2
kubectl get replicaset
kubectl describe replicaset nginx-deployment-7c7d6486fc
kuebctl get  pods
kubectl describe pod nginx-deployment-7c7d6486fc-btwcd

2.nginx-deployment配置文件。

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    run: nginx-deployment
  name: nginx-deployment
  namespace: default
spec:
  replicas: 2
  selector:
    matchLabels:
      run: nginx-deployment
  template:
    metadata:
      labels:
        run: nginx-deployment
    spec:
      containers:
      - image: nginx:1.7.9
        imagePullPolicy: IfNotPresent
        name: nginx-deployment
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      restartPolicy: Always

kubectl apply -f file.yaml
niginx-deployment配置文件简介,


image.png

3.将master作为node用来调度,解除master限制。


image.png

4.FailOver(k8s失败重试机制)


image.png image.png image.png

5.用label控制pod的位置


image.png
image.png
image.png
image.png image.png
上一篇 下一篇

猜你喜欢

热点阅读