Application Lifecycle Management(8%) [应用程序生命周期管理 占比 8%].
kubernetes.io > Documentation > Reference > kubectl CLI >kubectl Cheat Sheet
kubernetes.io > Documentation > Tasks > Run Applications > Perform Rolling Update Using a Replication Controller
kubernetes.io > Documentation > Concepts > Configuration > Secrets
kubernetes.io > Documentation > Tasks > Configure Pod and Containers > Configure a Pod to Use a ConfigMap
kubernetes.io > Documentation > Tasks> Inject Data into Applications > Define Environment Variables for a Container
kubernetes.io > Documentation > Concepts > Cluster Administration > Managing Resources
kubernetes.io > Documentation > Reference > Command line tools Reference > kube scheduler
Understand Deployments and how to perform rolling updates and rollbacks [理解部署以及如何执行滚动更新和回滚]
|
|
Know various ways to configure applications [理解配置应用程序的各种方法]
|
|
使用 env 键值对定义 Pod
|
|
该 Pod 类似于如下的 Docker 命令
|
|
您也可以使用 ConfigMap 作为键值对, 将 env 变量注入到 Pod 的定义中.
|
|
或者
|
|
或者
|
|
|
|
|
|
如果希望 DB 主机, 用户, 密码等环境变量传递给 web 应用程序, 建议使用 Kubernetes Secret.
|
|
或者
|
|
以编码格式存储 Secret
$ echo -n 'mysql' | base64 (对用户和密码重复此操作)
apiVersion: v1
kind: Secret
metadata:
name: app-secret
data:
DB_host: mysql
DB_user: root
DB_password: passwd
$ kubectl get scretes
$ kubectl get secret app-secret -o yaml (此处将显示编码后的值)
$ kubectl desc secrets
$ echo -n 'codedValue' | base64 --decode (如果你想解码这个 Secret 的值)
创建一个 Pod 来使用 Secret
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: sleep-pod
spec:
containers:
- name: nginx-container
image: nginx
ports:
- containerPort:8080
envFrom:
- secretRef:
name: app-secret
Know how to scale Applications [了解如何扩展应用程序]
$ kubectl scale deployments/kubernetes-bootcamp --replicas=4
$ kubectl edit (replicas object)
--replicas in Pod
Understand the primitives necessary to Crete a self-healing Application [理解创建自修复应用程序所需的基本类型]
Kubernetes 通过副本集和副本控制器支持自修复应用程序. 副本控制器有助于确保在 Pod 中的应用程序崩溃时自动创建 Pod. 它有助于确保在任何时候都运行足够的优越性副本集.
Kubernetes 提供了额外的支持来检查 Pods 中的应用程序的健康状况, 并通过 Liveness 和 Readiness Probes 来采取必要的行动.