k8s基本概念-如何使用Deployments

k8s基本概念-如何使用Deployments

2018/1/5

Deployments 使用示例

  • 创建一个 app
  • 查看 app 状态
  • 更新 app
  • 回滚 app
  • 扩缩容 app
  • 删除 app
创建一个 app
  • 通过 yaml 配置文件来定义 Deployment

    • 关于 apiVersion 的写法,请参考:
    • https://github.com/kubernetes/kubernetes/blob/630dbedef9de9ef678f16132796b103b8a03fcda/pkg/api/testing/defaulting_test.go
    • 关于 metadata 中的 name
    • 定义来 deployment 的名称
    • 同一个 namespace 下名称不能重复
    • 关于 metadata 中的 labels
    • k/v 键值对
    • key 的命名规则
      • 必须
      • 包含一个可选的 prefix 和 name 并小于 64 字符
      • name 以字母和数字 [a-z0-9A-Z] 开头和结尾,中间可以是 dashes (-),underscores (_),dots (.),字母和数字
      • prefix 是可选的,类似这样:"kubernetes.io/" 暂不讨论
    • Value 的命名规则
      • 可以为空,或小于 64 字符
      • 以字母和数字 [a-z0-9A-Z] 开头和结尾,中间可以是 dashes (-),underscores (_),dots (.),字母和数字
    • 关于 metadata 中的 namespace
    • 默认使用 default
      [[email protected] ~]# cat ~/k8s_install/test/whoami/app.yaml
      apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
      kind: Deployment
      metadata:
      name: test-deployment-app-whoami
      labels:
      app: whoami
      spec:
      replicas: 3
      selector:
      matchLabels:
      app: whoami
      template:
      metadata:
      labels:
      app: whoami
      spec:
      containers:
      - name: whoami
        image: opera443399/whoami:0.9
        ports:
          - containerPort: 80
  • 运行 app
    ### 注意:使用 --record 可以记录指令的 history 便于后续 rolling update 选择
    [[email protected] ~]# kubectl apply -f ~/k8s_install/test/whoami/app.yaml --record
    deployment "test-deployment-app-whoami" created
查看 app 状态
  • 查看信息

    [[email protected] ~]# kubectl get deployments
    NAME                         DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
    test-deployment-app-whoami   3         3         3            3           5m
    [[email protected] ~]# kubectl get rs
    NAME                                    DESIRED   CURRENT   READY     AGE
    test-deployment-app-whoami-6cf9cd6bf4   3         3         3         5m
    [[email protected] ~]# kubectl get pods
    NAME                                          READY     STATUS    RESTARTS   AGE
    test-deployment-app-whoami-6cf9cd6bf4-59h9x   1/1       Running   0          5m
    test-deployment-app-whoami-6cf9cd6bf4-978ht   1/1       Running   0          5m
    test-deployment-app-whoami-6cf9cd6bf4-w5dhk   1/1       Running   0          5m
    [[email protected] ~]# kubectl get pods --show-labels
    NAME                                          READY     STATUS    RESTARTS   AGE       LABELS
    test-deployment-app-whoami-6cf9cd6bf4-59h9x   1/1       Running   0          7m        app=whoami,pod-template-hash=2795782690
    test-deployment-app-whoami-6cf9cd6bf4-978ht   1/1       Running   0          7m        app=whoami,pod-template-hash=2795782690
    test-deployment-app-whoami-6cf9cd6bf4-w5dhk   1/1       Running   0          7m        app=whoami,pod-template-hash=2795782690
更新 app
  • 试着更新 1 次镜像后,查看信息,重点留意版本历史

    
    ### 更新 image 为其他版本:
    [[email protected] ~]# kubectl set image deployments/test-deployment-app-whoami whoami=opera443399/whoami:0.7
    deployment "test-deployment-app-whoami" image updated

查看信息

[[email protected] ~]# kubectl rollout status deployments/test-deployment-app-whoami
deployment "test-deployment-app-whoami" successfully rolled out
[[email protected] ~]# kubectl get deployments
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
test-deployment-app-whoami 3 3 3 3 11m
[[email protected] ~]# kubectl get rs
NAME DESIRED CURRENT READY AGE
test-deployment-app-whoami-68c6cd964 3 3 3 42s
test-deployment-app-whoami-6cf9cd6bf4 0 0 0 11m
[[email protected] ~]# kubectl get pods
NAME READY STATUS RESTARTS AGE
test-deployment-app-whoami-68c6cd964-bfznh 1/1 Running 0 54s
test-deployment-app-whoami-68c6cd964-r7vp5 1/1 Running 0 56s
test-deployment-app-whoami-68c6cd964-vssrj 1/1 Running 0 53s

[[email protected] ~]# kubectl describe deployments/test-deployment-app-whoami
Name: test-deployment-app-whoami
Namespace: default
CreationTimestamp: Wed, 27 Dec 2017 17:44:30 +0800
Labels: app=whoami
Annotations: deployment.kubernetes.io/revision=2
kubectl.kubernetes.io/last-applied-configuration=(略)
kubernetes.io/change-cause=kubectl set image deployments/test-deployment-app-whoami whoami=opera443399/whoami:0.7
Selector: app=whoami
Replicas: 3 desired
3 updated 3 total 3 available 0 unavailable
StrategyType: RollingUpdate
MinReadySeconds: 0
RollingUpdateStrategy: 25% max unavailable, 25% max surge
Pod Template:
Labels: app=whoami
Containers:
whoami:
Image: opera443399/whoami:0.7
Port: 80/TCP
Environment: <none>
Mounts: <none>
Volumes: <none>
Conditions:
Type Status Reason

Available True MinimumReplicasAvailable
Progressing True NewReplicaSetAvailable
OldReplicaSets: <none>
NewReplicaSet: test-deployment-app-whoami-68c6cd964 (3/3 replicas created)
Events:
Type Reason Age From Message



Normal ScalingReplicaSet 12m deployment-controller Scaled up replica set test-deployment-app-whoami-6cf9cd6bf4 to 3
Normal ScalingReplicaSet 1m deployment-controller Scaled up replica set test-deployment-app-whoami-68c6cd964 to 1
Normal ScalingReplicaSet 1m deployment-controller Scaled down replica set test-deployment-app-whoami-6cf9cd6bf4 to 2
Normal ScalingReplicaSet 1m deployment-controller Scaled up replica set test-deployment-app-whoami-68c6cd964 to 2
Normal ScalingReplicaSet 1m deployment-controller Scaled down replica set test-deployment-app-whoami-6cf9cd6bf4 to 1
Normal ScalingReplicaSet 1m deployment-controller Scaled up replica set test-deployment-app-whoami-68c6cd964 to 3
Normal ScalingReplicaSet 1m deployment-controller Scaled down replica set test-deployment-app-whoami-6cf9cd6bf4 to 0

[[email protected] ~]# kubectl rollout history deployments/test-deployment-app-whoami
deployments "test-deployment-app-whoami"
REVISION CHANGE-CAUSE
1 kubectl apply --filename=/root/k8s_install/test/whoami/app.yaml --record=true
2 kubectl set image deployments/test-deployment-app-whoami whoami=opera443399/whoami:0.7


- 再更新 1 次镜像后,再次查看信息
```bash
[[email protected] ~]# kubectl set image deployments/test-deployment-app-whoami whoami=opera443399/whoami:0.8
deployment "test-deployment-app-whoami" image updated
[[email protected] ~]# kubectl rollout status deployments/test-deployment-app-whoami
deployment "test-deployment-app-whoami" successfully rolled out
[[email protected] ~]# kubectl get deployments
NAME                         DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
test-deployment-app-whoami   3         3         3            3           17m
[[email protected] ~]# kubectl get rs
NAME                                    DESIRED   CURRENT   READY     AGE
test-deployment-app-whoami-68b94dd7bf   3         3         3         46s
test-deployment-app-whoami-68c6cd964    0         0         0         6m
test-deployment-app-whoami-6cf9cd6bf4   0         0         0         17m
[[email protected] ~]# kubectl get pods
NAME                                          READY     STATUS    RESTARTS   AGE
test-deployment-app-whoami-68b94dd7bf-5g89x   1/1       Running   0          45s
test-deployment-app-whoami-68b94dd7bf-75xjd   1/1       Running   0          52s
test-deployment-app-whoami-68b94dd7bf-pchpw   1/1       Running   0          49s
[[email protected] ~]# kubectl describe deployments/test-deployment-app-whoami
Name:                   test-deployment-app-whoami
Namespace:              default
CreationTimestamp:      Wed, 27 Dec 2017 17:44:30 +0800
Labels:                 app=whoami
Annotations:            deployment.kubernetes.io/revision=3
                        kubectl.kubernetes.io/last-applied-configuration=(略)
                        kubernetes.io/change-cause=kubectl set image deployments/test-deployment-app-whoami whoami=opera443399/whoami:0.8
Selector:               app=whoami
Replicas:               3 desired | 3 updated | 3 total | 3 available | 0 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        0
RollingUpdateStrategy:  25% max unavailable, 25% max surge
Pod Template:
  Labels:  app=whoami
  Containers:
   whoami:
    Image:        opera443399/whoami:0.8
    Port:         80/TCP
    Environment:  <none>
    Mounts:       <none>
  Volumes:        <none>
Conditions:
  Type           Status  Reason
  ----           ------  ------
  Available      True    MinimumReplicasAvailable
  Progressing    True    NewReplicaSetAvailable
OldReplicaSets:  <none>
NewReplicaSet:   test-deployment-app-whoami-68b94dd7bf (3/3 replicas created)
Events:
  Type    Reason             Age              From                   Message
  ----    ------             ----             ----                   -------
  Normal  ScalingReplicaSet  18m              deployment-controller  Scaled up replica set test-deployment-app-whoami-6cf9cd6bf4 to 3
  Normal  ScalingReplicaSet  7m               deployment-controller  Scaled up replica set test-deployment-app-whoami-68c6cd964 to 1
  Normal  ScalingReplicaSet  7m               deployment-controller  Scaled down replica set test-deployment-app-whoami-6cf9cd6bf4 to 2
  Normal  ScalingReplicaSet  7m               deployment-controller  Scaled up replica set test-deployment-app-whoami-68c6cd964 to 2
  Normal  ScalingReplicaSet  7m               deployment-controller  Scaled down replica set test-deployment-app-whoami-6cf9cd6bf4 to 1
  Normal  ScalingReplicaSet  7m               deployment-controller  Scaled up replica set test-deployment-app-whoami-68c6cd964 to 3
  Normal  ScalingReplicaSet  7m               deployment-controller  Scaled down replica set test-deployment-app-whoami-6cf9cd6bf4 to 0
  Normal  ScalingReplicaSet  2m               deployment-controller  Scaled up replica set test-deployment-app-whoami-68b94dd7bf to 1
  Normal  ScalingReplicaSet  2m               deployment-controller  Scaled down replica set test-deployment-app-whoami-68c6cd964 to 2
  Normal  ScalingReplicaSet  2m               deployment-controller  Scaled up replica set test-deployment-app-whoami-68b94dd7bf to 2
  Normal  ScalingReplicaSet  2m (x3 over 2m)  deployment-controller  (combined from similar events): Scaled down replica set test-deployment-app-whoami-68c6cd964 to 0
[[email protected] ~]# kubectl rollout history deployments/test-deployment-app-whoami
deployments "test-deployment-app-whoami"
REVISION  CHANGE-CAUSE
1         kubectl apply --filename=/root/k8s_install/test/whoami/app.yaml --record=true
2         kubectl set image deployments/test-deployment-app-whoami whoami=opera443399/whoami:0.7
3         kubectl set image deployments/test-deployment-app-whoami whoami=opera443399/whoami:0.8

### 符合预期,我们现在有了 3 个版本
回滚 app
  • 回滚到上一个版本

    
    [[email protected] ~]# kubectl rollout undo deployments/test-deployment-app-whoami
    deployment "test-deployment-app-whoami"
    [[email protected] ~]# kubectl rollout history deployments/test-deployment-app-whoami
    deployments "test-deployment-app-whoami"
    REVISION  CHANGE-CAUSE
    1         kubectl apply --filename=/root/k8s_install/test/whoami/app.yaml --record=true
    3         kubectl set image deployments/test-deployment-app-whoami whoami=opera443399/whoami:0.8
    4         kubectl set image deployments/test-deployment-app-whoami whoami=opera443399/whoami:0.7

[[email protected] ~]# kubectl get rs
NAME DESIRED CURRENT READY AGE
test-deployment-app-whoami-68b94dd7bf 0 0 0 16m
test-deployment-app-whoami-68c6cd964 3 3 3 22m
test-deployment-app-whoami-6cf9cd6bf4 0 0 0 33m

[[email protected] ~]# kubectl describe deployments/test-deployment-app-whoami
Name: test-deployment-app-whoami
Namespace: default
CreationTimestamp: Wed, 27 Dec 2017 17:44:30 +0800
Labels: app=whoami
Annotations: deployment.kubernetes.io/revision=4
kubectl.kubernetes.io/last-applied-configuration=(略)
kubernetes.io/change-cause=kubectl set image deployments/test-deployment-app-whoami whoami=opera443399/whoami:0.7
Selector: app=whoami
Replicas: 3 desired
3 updated 3 total 3 available 0 unavailable
StrategyType: RollingUpdate
MinReadySeconds: 0
RollingUpdateStrategy: 25% max unavailable, 25% max surge
Pod Template:
Labels: app=whoami
Containers:
whoami:
Image: opera443399/whoami:0.7
Port: 80/TCP
Environment: <none>
Mounts: <none>
Volumes: <none>
Conditions:
Type Status Reason

Available True MinimumReplicasAvailable
Progressing True NewReplicaSetAvailable
OldReplicaSets: <none>
NewReplicaSet: test-deployment-app-whoami-68c6cd964 (3/3 replicas created)
Events:
Type Reason Age From Message



Normal ScalingReplicaSet 27m deployment-controller Scaled up replica set test-deployment-app-whoami-6cf9cd6bf4 to 3
Normal ScalingReplicaSet 17m deployment-controller Scaled down replica set test-deployment-app-whoami-6cf9cd6bf4 to 2
Normal ScalingReplicaSet 17m deployment-controller Scaled up replica set test-deployment-app-whoami-68c6cd964 to 2
Normal ScalingReplicaSet 17m deployment-controller Scaled down replica set test-deployment-app-whoami-6cf9cd6bf4 to 1
Normal ScalingReplicaSet 17m deployment-controller Scaled up replica set test-deployment-app-whoami-68c6cd964 to 3
Normal ScalingReplicaSet 16m deployment-controller Scaled down replica set test-deployment-app-whoami-6cf9cd6bf4 to 0
Normal ScalingReplicaSet 11m deployment-controller Scaled up replica set test-deployment-app-whoami-68b94dd7bf to 1
Normal ScalingReplicaSet 11m deployment-controller Scaled down replica set test-deployment-app-whoami-68c6cd964 to 2
Normal ScalingReplicaSet 11m deployment-controller Scaled up replica set test-deployment-app-whoami-68b94dd7bf to 2
Normal ScalingReplicaSet 1m (x2 over 17m) deployment-controller Scaled up replica set test-deployment-app-whoami-68c6cd964 to 1
Normal DeploymentRollback 1m deployment-controller Rolled back deployment "test-deployment-app-whoami" to revision 2
Normal ScalingReplicaSet 1m (x8 over 11m) deployment-controller (combined from similar events): Scaled down replica set test-deployment-app-whoami-68b94dd7bf to 0


- 回滚到指定的版本
```bash
[[email protected] ~]# kubectl rollout undo deployments/test-deployment-app-whoami --to-revision=1
deployment "test-deployment-app-whoami"
[[email protected] ~]# kubectl rollout history deployments/test-deployment-app-whoami
deployments "test-deployment-app-whoami"
REVISION  CHANGE-CAUSE
3         kubectl set image deployments/test-deployment-app-whoami whoami=opera443399/whoami:0.8
4         kubectl set image deployments/test-deployment-app-whoami whoami=opera443399/whoami:0.7
5         kubectl apply --filename=/root/k8s_install/test/whoami/app.yaml --record=true

[[email protected] ~]# kubectl get rs
NAME                                    DESIRED   CURRENT   READY     AGE
test-deployment-app-whoami-68b94dd7bf   0         0         0         16m
test-deployment-app-whoami-68c6cd964    0         0         0         22m
test-deployment-app-whoami-6cf9cd6bf4   3         3         3         33m

[[email protected] ~]# kubectl describe deployments/test-deployment-app-whoami
Name:                   test-deployment-app-whoami
Namespace:              default
CreationTimestamp:      Wed, 27 Dec 2017 17:44:30 +0800
Labels:                 app=whoami
Annotations:            deployment.kubernetes.io/revision=5
                        kubectl.kubernetes.io/last-applied-configuration=(略)
                        kubernetes.io/change-cause=kubectl apply --filename=/root/k8s_install/test/whoami/app.yaml --record=true
Selector:               app=whoami
Replicas:               3 desired | 3 updated | 3 total | 3 available | 0 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        0
RollingUpdateStrategy:  25% max unavailable, 25% max surge
Pod Template:
  Labels:  app=whoami
  Containers:
   whoami:
    Image:        opera443399/whoami:0.9
    Port:         80/TCP
    Environment:  <none>
    Mounts:       <none>
  Volumes:        <none>
Conditions:
  Type           Status  Reason
  ----           ------  ------
  Available      True    MinimumReplicasAvailable
  Progressing    True    NewReplicaSetAvailable
OldReplicaSets:  <none>
NewReplicaSet:   test-deployment-app-whoami-6cf9cd6bf4 (3/3 replicas created)
Events:
  Type    Reason              Age                 From                   Message
  ----    ------              ----                ----                   -------
  Normal  ScalingReplicaSet   29m                 deployment-controller  Scaled up replica set test-deployment-app-whoami-6cf9cd6bf4 to 3
  Normal  ScalingReplicaSet   19m                 deployment-controller  Scaled down replica set test-deployment-app-whoami-6cf9cd6bf4 to 2
  Normal  ScalingReplicaSet   19m                 deployment-controller  Scaled up replica set test-deployment-app-whoami-68c6cd964 to 2
  Normal  ScalingReplicaSet   19m                 deployment-controller  Scaled down replica set test-deployment-app-whoami-6cf9cd6bf4 to 1
  Normal  ScalingReplicaSet   19m                 deployment-controller  Scaled up replica set test-deployment-app-whoami-68c6cd964 to 3
  Normal  ScalingReplicaSet   19m                 deployment-controller  Scaled down replica set test-deployment-app-whoami-6cf9cd6bf4 to 0
  Normal  ScalingReplicaSet   13m                 deployment-controller  Scaled up replica set test-deployment-app-whoami-68b94dd7bf to 1
  Normal  ScalingReplicaSet   13m                 deployment-controller  Scaled down replica set test-deployment-app-whoami-68c6cd964 to 2
  Normal  ScalingReplicaSet   13m                 deployment-controller  Scaled up replica set test-deployment-app-whoami-68b94dd7bf to 2
  Normal  ScalingReplicaSet   3m (x2 over 19m)    deployment-controller  Scaled up replica set test-deployment-app-whoami-68c6cd964 to 1
  Normal  DeploymentRollback  3m                  deployment-controller  Rolled back deployment "test-deployment-app-whoami" to revision 2
  Normal  DeploymentRollback  29s                 deployment-controller  Rolled back deployment "test-deployment-app-whoami" to revision 1
  Normal  ScalingReplicaSet   27s (x12 over 13m)  deployment-controller  (combined from similar events): Scaled up replica set test-deployment-app-whoami-6cf9cd6bf4 to 3
  Normal  ScalingReplicaSet   27s                 deployment-controller  Scaled down replica set test-deployment-app-whoami-68c6cd964 to 1
  Normal  ScalingReplicaSet   26s                 deployment-controller  Scaled down replica set test-deployment-app-whoami-68c6cd964 to 0
扩缩容 app
  • 扩容

    
    ### 调整副本数量到 10 个
    [[email protected] ~]# kubectl scale deployments/test-deployment-app-whoami --replicas=10
    deployment "test-deployment-app-whoami" scaled

查看信息

[[email protected] ~]# kubectl get deployments
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
test-deployment-app-whoami 10 10 10 10 39m
[[email protected] ~]# kubectl get rs
NAME DESIRED CURRENT READY AGE
test-deployment-app-whoami-68b94dd7bf 0 0 0 23m
test-deployment-app-whoami-68c6cd964 0 0 0 29m
test-deployment-app-whoami-6cf9cd6bf4 10 10 10 39m
[[email protected] ~]# kubectl get pods
NAME READY STATUS RESTARTS AGE
test-deployment-app-whoami-6cf9cd6bf4-2dd5m 1/1 Running 0 36s
test-deployment-app-whoami-6cf9cd6bf4-4nx7x 1/1 Running 0 36s
test-deployment-app-whoami-6cf9cd6bf4-bb7v7 1/1 Running 0 10m
test-deployment-app-whoami-6cf9cd6bf4-c7cht 1/1 Running 0 36s
test-deployment-app-whoami-6cf9cd6bf4-dph22 1/1 Running 0 36s
test-deployment-app-whoami-6cf9cd6bf4-jhtqz 1/1 Running 0 10m
test-deployment-app-whoami-6cf9cd6bf4-jjfp5 1/1 Running 0 36s
test-deployment-app-whoami-6cf9cd6bf4-nlqq5 1/1 Running 0 36s
test-deployment-app-whoami-6cf9cd6bf4-px24h 1/1 Running 0 10m
test-deployment-app-whoami-6cf9cd6bf4-rldhd 1/1 Running 0 36s


- 缩容
```bash
### 调整副本数量到 5 个
[[email protected] ~]# kubectl scale deployments/test-deployment-app-whoami --replicas=5
deployment "test-deployment-app-whoami" scaled

### 查看信息
[[email protected] ~]# kubectl get deployments
NAME                         DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
test-deployment-app-whoami   5         5         5            5           41m
[[email protected] ~]# kubectl get rs
NAME                                    DESIRED   CURRENT   READY     AGE
test-deployment-app-whoami-68b94dd7bf   0         0         0         25m
test-deployment-app-whoami-68c6cd964    0         0         0         30m
test-deployment-app-whoami-6cf9cd6bf4   5         5         5         41m
[[email protected] ~]# kubectl get pods
NAME                                          READY     STATUS    RESTARTS   AGE
test-deployment-app-whoami-6cf9cd6bf4-2dd5m   1/1       Running   0          2m
test-deployment-app-whoami-6cf9cd6bf4-bb7v7   1/1       Running   0          12m
test-deployment-app-whoami-6cf9cd6bf4-c7cht   1/1       Running   0          2m
test-deployment-app-whoami-6cf9cd6bf4-jhtqz   1/1       Running   0          12m
test-deployment-app-whoami-6cf9cd6bf4-px24h   1/1       Running   0          12m
删除
[[email protected] test]# kubectl delete deployments/test-deployment-app-whoami
deployment "test-deployment-app-whoami" deleted
[[email protected] test]# kubectl get deployments
No resources found.

原文地址:http://blog.51cto.com/nosmoking/2062902

时间: 2024-11-06 09:51:30

k8s基本概念-如何使用Deployments的相关文章

k8s基本概念-如何使用Services

k8s基本概念-如何使用Services 2018/1/5 Services 使用示例 Virtual IPs and service proxies Publishing services - service types 通过命令行来控制 Service 通过 yaml 配置文件来定义 Service Virtual IPs and service proxies Proxy-mode: userspace 轮询 Proxy-mode: iptables v1.2开始作为默认选项 比 user

k8s学习 - 概念 - Deployment

k8s学习 - 概念 - Deployment 有了 ReplicaSet 还需要有 Deployment 的原因是希望有一个控制器能管理部署更新时候的版本控制问题.一个 Deployment 可以管理多个 ReplicaSet, 一个 ReplicaSet 可以管理多个 Pod.最通用的场景是当我们对某个 Pod 里面的镜像进行升级的时候,我们非常迫切需要有一个版本号概念,并且在发现问题的时候可以随时回滚.那么这个就是 Deployment 的使命. 使用 官方和很多文章都是使用 nginx

k8s基本概念-配置调度策略之(Taints-and-Tolerations)

k8s基本概念-配置调度策略之(Taints-and-Tolerations) 2018/4/12 通过定义 Taints and Tolerations 来达到 node 排斥 pod 的目的 通过一个典型实例来描述 taint 和 toleration 之间的关联 测试前的集群状态 部署app whoami-t1 测试 taint 的用法 测试结果 测试使用 toleration 测试结果 如何移除指定的 taint 呢? 聊一聊 Taints and Tolerations 的细节 概念

kubernetes(k8s) 基础概念

K8S基础概念 1.Node Node作为集群中的工作节点,运行真正的应用程序,在Node上Kubernetes管理的最小运行单元是Pod.Node上运行着Kubernetes的Kubelet.kube-proxy服务进程,这些服务进程负责Pod的创建.启动.监控.重启.销毁.以及实现软件模式的负载均衡. Node包含的信息: Node地址:主机的IP地址,或Node ID. Node的运行状态:Pending.Running.Terminated三种状态. Node Condition:- N

k8s学习 - 概念 - Pod

k8s学习 - 概念 - Pod 这篇继续看概念,主要是 Pod 这个概念,这个概念非常重要,是 k8s 集群的最小单位. 怎么才算是理解好 pod 了呢,基本上把 pod 的所有 describe 和配置文件的配置项都能看懂就算是对 pod 比较了解了. Pod 我们通过调用一个kubectl describe pod xxx 可以查看某个 pod 的具体信息. describe 的信息我们用注释的形式来解读. Name: task-pv-pod Namespace: default // 没

k8s学习 - 概念 - ReplicaSet

k8s学习 - 概念 - ReplicaSet 首先,ReplicaSet 和 ReplicationController 基本上一样,除了上篇说到的selector有不同之外,没有啥区别.(官网也是这么说的).但是为什么官方建议的不是ReplicaController + Deployment的集合呢?咋们也不敢说,咋们也不敢问.反正我就知道,用 ReplicationController 的值得被鄙视,用ReplicationSet +deployment 的现在是正统. ReplicaSe

k8s基本概念

一.k8s基本概念 k8s大部分概念比如Node,Pod.RC,service等都可以看做一种资源对象,几乎所有的资源对象都可以通过k8s提供的kubectl工具执行增,删,改,查等操作并将其保存在etcd中持久化存储. 二.master master指的是集群控制节点,来负责整个集群的管理和控制,基本上k8s的所有控制命令都是发给它.我们后面执行的命令基本都是在master节点上运行的.通常它会占据一个独立的x86服务器(或一个虚拟机). master节点上运行一些关键进程: k8s API

k8s 重要概念 - 每天5分钟玩转 Docker 容器技术(117)

在实践之前,必须先学习 Kubernetes 的几个重要概念,它们是组成 Kubernetes 集群的基石. Cluster Cluster 是计算.存储和网络资源的集合,Kubernetes 利用这些资源运行各种基于容器的应用. Master Master 是 Cluster 的大脑,它的主要职责是调度,即决定将应用放在哪里运行.Master 运行 Linux 操作系统,可以是物理机或者虚拟机.为了实现高可用,可以运行多个 Master. Node Node 的职责是运行容器应用.Node 由

docker和k8s的概念-IaaS、PaaS、SaaS 的区别

docker和k8s 参考: 什么是Docker? Kubernetes概述 openstack,docker,mesos,k8s什么关系? IaaS.PaaS.SaaS的概念 SaaS:软件服务,Software-as-a-service PaaS:平台服务,Platform-as-a-service IaaS:基础设施服务,Infrastructure-as-a-service IaaS IaaS 是云服务的最底层,主要提供一些基础资源 PaaS PaaS 提供软件部署平台(runtime)