CKA-Day02:工作负载、调度、服务、存储

1、部署、滚动更新、回滚

Deployments

使用set image命令更新镜像
在这里插入图片描述
kb get deploy -owide
在这里插入图片描述
在这里插入图片描述
kb get pod -w
在这里插入图片描述rollout history

rollout status

rollout undo
在这里插入图片描述

暂停、恢复Deployment的上线过程

rollout pause

rollout resume
在这里插入图片描述

StatefulSet

kb create sts -h 命令行不能创建sts资源?
在这里插入图片描述

spec:
  podManagementPolicy: OrderedReady
  replicas: 3
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: nginx
  serviceName: nginx
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: nginx
    spec:
      containers:
      - image: nginx
        imagePullPolicy: Always
        name: nginx
        ports:
        - containerPort: 80
          name: web
          protocol: TCP
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /usr/share/nginx/html
          name: www
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 10
  updateStrategy:
    rollingUpdate:
      partition: 0
    type: RollingUpdate
  volumeClaimTemplates:
  - apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      creationTimestamp: null
      name: www
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 1Gi
      storageClassName: csi-localpv
      volumeMode: Filesystem
    status:
      phase: Pending

在这里插入图片描述

访问模式

在这里插入图片描述

制备

在这里插入图片描述

回收

在这里插入图片描述

PersistentVolumeClaim保留

在这里插入图片描述

在这里插入图片描述

Service

在这里插入图片描述

在这里插入图片描述

spec:
  clusterIP: 246.96.132.18
  externalTrafficPolicy: Cluster
  ports:
  - name: 380-80
    nodePort: 30021
    port: 380
    protocol: TCP
    targetPort: 80
  selector:
    app: nginx
  sessionAffinity: None
  type: NodePort

在这里插入图片描述

2、存储

ConfigMaps

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
Read-only file system
在这里插入图片描述

Secret

kubectl create secret 【Secret类型】 【Secret名称】
kb create secret
Create a secret using specified subcommand.

Available Commands:
  docker-registry Create a secret for use with a Docker registry
  generic         Create a secret from a local file, directory or literal value
  tls             Create a TLS secret

Usage:
  kubectl create secret [flags] [options]

Use "kubectl <command> --help" for more information about a given command.
Use "kubectl options" for a list of global command-line options (applies to all commands).

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

在使用 echo “secret” |base64 命令时,实际得到的结果是 c2VjcmV0Cg== 而不是 c2VjcmV0,这是因为 echo 命令默认会添加一个换行符(\n)。

所以你实际上是在对 “secret\n” (包含一个换行符)进行 base64 编码,而不只是 “secret”。

如果你想避免 echo 命令添加的换行符,你可以使用 -n 选项,如下:

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

hostPath

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

rollout restart sts ?

在这里插入图片描述

在这里插入图片描述

  • 14
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值