4月15日
    时间:20:30-21-:30
    课时 3
    课外基础
    0.回顾Docker
    1.预备课程所需要的环境 ,虚拟机Terminal工具和必须的记录工具
    2.工具准备 :VirtualBox ,Ntepad+ , Wireshak ,Xeltc
    3.做好和课程同步的时间安排计划 ,对应相的课节记录
    4.要求至少需 1Master+1Nod 的环境,后期的课后作业需要使用到

    课程重点
    通过学习能快速搭建一个 Kubernts 集群,并且能够根据各组件之间的关系 ,掌握基本的TS技能。并且我们会根据已有的环境 ,搭建一个Project,从而掌握一个完成的项目所涉及到kubernts 的所有相关细节

    kubernetes 基础介绍
    Docker与Kubernetes的关系
    Kubernetes是什么?
    为什么要选择使用kubernetes
    Kubernetes的架构介绍和主要组件的功能
    Kubernetes的基本概念和集群术语
    Kubernetes的资源对象介绍

    4月16日
    20:30-22:30

    课程重点
    Kubernetes集群安装和部署
    Kubernetes的集群部署方式介绍
    Minkube
    Kubeadm
    二进制
    自动化部署
    通过kubernetes部署应用服务实践

    1. cat << EOF | kubectl create -f -
    2. xxx
    3. xxx
    4. ...
    5. EOF
    1. apiVersion: v1
    2. kind: Pod
    3. metadata:
    4. name: readiness-httpget-pod
    5. namespace: default
    6. spec:
    7. containers:
    8. - name: readiness-httpget-container
    9. image: ikubernetes/myapp:v1
    10. imagePullPolicy: IfNotPresent
    11. ports:
    12. - name: http
    13. containerPort: 80
    14. readinessProbe:
    15. httpGet:
    16. port: http
    17. path: /index.html
    18. initialDelaySeconds: 1
    19. periodSeconds: 3

    静态pod
    [root@master manifests]# pwd
    /etc/kubernetes/manifests
    [root@master manifests]# ll
    total 16
    -rw———- 1 root root 1783 Feb 4 21:26 etcd.yaml
    -rw———- 1 root root 2709 Apr 12 19:59 kube-apiserver.yaml
    -rw———- 1 root root 2566 Apr 12 19:59 kube-controller-manager.yaml
    -rw———- 1 root root 1120 Apr 12 19:59 kube-scheduler.yaml
    [root@master manifests]#

    1. [root@master ~]# systemctl cat kubelet.service
    2. # /usr/lib/systemd/system/kubelet.service
    3. [Unit]
    4. Description=kubelet: The Kubernetes Node Agent
    5. Documentation=https://kubernetes.io/docs/
    6. [Service]
    7. ExecStart=/usr/bin/kubelet
    8. Restart=always
    9. StartLimitInterval=0
    10. RestartSec=10
    11. [Install]
    12. WantedBy=multi-user.target
    13. # /usr/lib/systemd/system/kubelet.service.d/10-kubeadm.conf
    14. # Note: This dropin only works with kubeadm and kubelet v1.11+
    15. [Service]
    16. Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes
    17. Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml"
    18. # This is a file that "kubeadm init" and "kubeadm join" generates at runtim
    19. EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env
    20. # This is a file that the user can use for overrides of the kubelet args as
    21. # the .NodeRegistration.KubeletExtraArgs object in the configuration files
    22. EnvironmentFile=-/etc/sysconfig/kubelet
    23. ExecStart=
    24. ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $K
    25. lines 1-26/26 (END)...skipping...
    26. # /usr/lib/systemd/system/kubelet.service
    27. [Unit]
    28. Description=kubelet: The Kubernetes Node Agent
    29. Documentation=https://kubernetes.io/docs/
    30. [Service]
    31. ExecStart=/usr/bin/kubelet
    32. Restart=always
    33. StartLimitInterval=0
    34. RestartSec=10
    35. [Install]
    36. WantedBy=multi-user.target
    37. # /usr/lib/systemd/system/kubelet.service.d/10-kubeadm.conf
    38. # Note: This dropin only works with kubeadm and kubelet v1.11+
    39. [Service]
    40. Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet
    41. Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml"
    42. # This is a file that "kubeadm init" and "kubeadm join" generates at runtime, populating the KUBELET_KUBEADM_ARGS variable dynamically
    43. EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env
    44. # This is a file that the user can use for overrides of the kubelet args as a last resort. Preferably, the user should use
    45. # the .NodeRegistration.KubeletExtraArgs object in the configuration files instead. KUBELET_EXTRA_ARGS should be sourced from this file
    46. EnvironmentFile=-/etc/sysconfig/kubelet
    47. ExecStart=
    48. ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS
    49. ~
    50. ~
    51. ~
    52. ~
    53. ~
    54. ~
    55. ~
    56. ~
    57. [root@master ~]#

    升级内核

    1. 升级kernel:升级为最新版本的kernel
    2. uname -r
    3. rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
    4. rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
    5. yum --enablerepo=elrepo-kernel install kernel-ml-devel kernel-ml -y
    6. grub2-set-default 0
    7. reboot
    8. uname -r

    4月18日
    14:00-16:00

    课外基础
    0.熟悉上次课中的 Demo
    1.了解虚机和 pod的区别和 pod的优势
    2.了解Pod的本质,以及Pod和Cntaier 的关系
    3.Pod自动部署已经 CKA涉及到的应用
    4.了解INT容器的应用场景

    课程重点
    通过学习 Kubernts 的基本单元Pod的概念和本质 ,数量的掌握该模块
    Pod状态与生命周期管理 -健康性检查

    Pod 概述与创建
    Pod 解析与理
    Init 容器介绍及案例分析
    Pause 容器介绍及应用
    Pod 安全策略及应用
    Pod 的生命周期管理
    Pod 自动部署
    Pod Prest
    Pod 健康性检查及探针

    课外知识
    1.掌握Kubernts 的Maer 和Nod角色定义,何为主,何为主工作节点 [掌握分布式架构 ]
    2.掌握Kubernts 的Label和 Sector的概念和使用案例
    3.掌握Kubernts 垃圾回收机制

    1. [root@master yaml]# kubectl run demo --image=ikubernetes/myapp:v1 --restart=Never --dry-run=true -o yaml
    2. W0412 23:17:46.373425 76654 helpers.go:549] --dry-run=true is deprecated (boolean value) and can be replaced with --dry-run=client.
    3. apiVersion: v1
    4. kind: Pod
    5. metadata:
    6. creationTimestamp: null
    7. labels:
    8. run: demo
    9. name: demo
    10. spec:
    11. containers:
    12. - image: ikubernetes/myapp:v1
    13. name: demo
    14. resources: {}
    15. dnsPolicy: ClusterFirst
    16. restartPolicy: Never
    17. status: {}
    18. [root@master yaml]# kubectl run demo --image=ikubernetes/myapp:v1 --restart=Never --dry-run=true -o yaml > demo.yaml
    19. W0412 23:18:09.561667 77168 helpers.go:549] --dry-run=true is deprecated (boolean value) and can be replaced with --dry-run=client.
    20. [root@master yaml]#
    21. [root@master yaml]# ll
    22. total 4
    23. -rw-r----- 1 root root 243 Apr 12 23:18 demo.yaml
    24. [root@master yaml]# cat demo.yaml
    25. apiVersion: v1
    26. kind: Pod
    27. metadata:
    28. creationTimestamp: null
    29. labels:
    30. run: demo
    31. name: demo
    32. spec:
    33. containers:
    34. - image: ikubernetes/myapp:v1
    35. name: demo
    36. resources: {}
    37. dnsPolicy: ClusterFirst
    38. restartPolicy: Never
    39. status: {}
    40. [root@master yaml]#
    41. [root@master yaml]# cat demo.yaml
    42. apiVersion: v1
    43. kind: Pod
    44. metadata:
    45. creationTimestamp: null
    46. labels:
    47. run: demo
    48. name: demo
    49. spec:
    50. containers:
    51. - image: ikubernetes/myapp:v1
    52. name: demo
    53. resources: {}
    54. dnsPolicy: ClusterFirst
    55. restartPolicy: Never
    56. status: {}
    57. [root@master yaml]#
    1. [root@master ~]# kubectl explain
    2. error: You must specify the type of resource to explain. Use "kubectl api-resources" for a complete list of supported resources.
    3. [root@master ~]#
    4. [root@master ~]# kubectl explain --help
    5. List the fields for supported resources
    6. This command describes the fields associated with each supported API resource. Fields are identified via a simple
    7. JSONPath identifier:
    8. <type>.<fieldName>[.<fieldName>]
    9. Add the --recursive flag to display all of the fields at once without descriptions. Information about each field is
    10. retrieved from the server in OpenAPI format.
    11. Use "kubectl api-resources" for a complete list of supported resources.
    12. Examples:
    13. # Get the documentation of the resource and its fields
    14. kubectl explain pods
    15. # Get the documentation of a specific field of a resource
    16. kubectl explain pods.spec.containers
    17. Options:
    18. --api-version='': Get different explanations for particular API version
    19. --recursive=false: Print the fields of fields (Currently only 1 level deep)
    20. Usage:
    21. kubectl explain RESOURCE [options]
    22. Use "kubectl options" for a list of global command-line options (applies to all commands).
    23. [root@master ~]# kubectl explain pod --help
    24. List the fields for supported resources
    25. This command describes the fields associated with each supported API resource. Fields are identified via a simple
    26. JSONPath identifier:
    27. <type>.<fieldName>[.<fieldName>]
    28. Add the --recursive flag to display all of the fields at once without descriptions. Information about each field is
    29. retrieved from the server in OpenAPI format.
    30. Use "kubectl api-resources" for a complete list of supported resources.
    31. Examples:
    32. # Get the documentation of the resource and its fields
    33. kubectl explain pods
    34. # Get the documentation of a specific field of a resource
    35. kubectl explain pods.spec.containers
    36. Options:
    37. --api-version='': Get different explanations for particular API version
    38. --recursive=false: Print the fields of fields (Currently only 1 level deep)
    39. Usage:
    40. kubectl explain RESOURCE [options]
    41. Use "kubectl options" for a list of global command-line options (applies to all commands).
    42. [root@master ~]#
    1. [root@master ~]# kubectl explain pod.spec
    2. KIND: Pod
    3. VERSION: v1
    4. RESOURCE: spec <Object>
    5. DESCRIPTION:
    6. Specification of the desired behavior of the pod. More info:
    7. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
    8. PodSpec is a description of a pod.
    9. FIELDS:
    10. activeDeadlineSeconds <integer>
    11. Optional duration in seconds the pod may be active on the node relative to
    12. StartTime before the system will actively try to mark it failed and kill
    13. associated containers. Value must be a positive integer.
    14. affinity <Object>
    15. If specified, the pod's scheduling constraints
    16. automountServiceAccountToken <boolean>
    17. AutomountServiceAccountToken indicates whether a service account token
    18. should be automatically mounted.
    19. containers <[]Object> -required-
    20. List of containers belonging to the pod. Containers cannot currently be
    21. added or removed. There must be at least one container in a Pod. Cannot be
    22. updated.
    23. dnsConfig <Object>
    24. Specifies the DNS parameters of a pod. Parameters specified here will be
    25. merged to the generated DNS configuration based on DNSPolicy.
    26. dnsPolicy <string>
    27. Set DNS policy for the pod. Defaults to "ClusterFirst". Valid values are
    28. 'ClusterFirstWithHostNet', 'ClusterFirst', 'Default' or 'None'. DNS
    29. parameters given in DNSConfig will be merged with the policy selected with
    30. DNSPolicy. To have DNS options set along with hostNetwork, you have to
    31. specify DNS policy explicitly to 'ClusterFirstWithHostNet'.
    32. enableServiceLinks <boolean>
    33. EnableServiceLinks indicates whether information about services should be
    34. injected into pod's environment variables, matching the syntax of Docker
    35. links. Optional: Defaults to true.
    36. ephemeralContainers <[]Object>
    37. List of ephemeral containers run in this pod. Ephemeral containers may be
    38. run in an existing pod to perform user-initiated actions such as debugging.
    39. This list cannot be specified when creating a pod, and it cannot be
    40. modified by updating the pod spec. In order to add an ephemeral container
    41. to an existing pod, use the pod's ephemeralcontainers subresource. This
    42. field is alpha-level and is only honored by servers that enable the
    43. EphemeralContainers feature.
    44. hostAliases <[]Object>
    45. HostAliases is an optional list of hosts and IPs that will be injected into
    46. the pod's hosts file if specified. This is only valid for non-hostNetwork
    47. pods.
    48. hostIPC <boolean>
    49. Use the host's ipc namespace. Optional: Default to false.
    50. hostNetwork <boolean>
    51. Host networking requested for this pod. Use the host's network namespace.
    52. If this option is set, the ports that will be used must be specified.
    53. Default to false.
    54. hostPID <boolean>
    55. Use the host's pid namespace. Optional: Default to false.
    56. hostname <string>
    57. Specifies the hostname of the Pod If not specified, the pod's hostname will
    58. be set to a system-defined value.
    59. imagePullSecrets <[]Object>
    60. ImagePullSecrets is an optional list of references to secrets in the same
    61. namespace to use for pulling any of the images used by this PodSpec. If
    62. specified, these secrets will be passed to individual puller
    63. implementations for them to use. For example, in the case of docker, only
    64. DockerConfig type secrets are honored. More info:
    65. https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod
    66. initContainers <[]Object>
    67. List of initialization containers belonging to the pod. Init containers are
    68. executed in order prior to containers being started. If any init container
    69. fails, the pod is considered to have failed and is handled according to its
    70. restartPolicy. The name for an init container or normal container must be
    71. unique among all containers. Init containers may not have Lifecycle
    72. actions, Readiness probes, Liveness probes, or Startup probes. The
    73. resourceRequirements of an init container are taken into account during
    74. scheduling by finding the highest request/limit for each resource type, and
    75. then using the max of of that value or the sum of the normal containers.
    76. Limits are applied to init containers in a similar fashion. Init containers
    77. cannot currently be added or removed. Cannot be updated. More info:
    78. https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
    79. nodeName <string>
    80. NodeName is a request to schedule this pod onto a specific node. If it is
    81. non-empty, the scheduler simply schedules this pod onto that node, assuming
    82. that it fits resource requirements.
    83. nodeSelector <map[string]string>
    84. NodeSelector is a selector which must be true for the pod to fit on a node.
    85. Selector which must match a node's labels for the pod to be scheduled on
    86. that node. More info:
    87. https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
    88. overhead <map[string]string>
    89. Overhead represents the resource overhead associated with running a pod for
    90. a given RuntimeClass. This field will be autopopulated at admission time by
    91. the RuntimeClass admission controller. If the RuntimeClass admission
    92. controller is enabled, overhead must not be set in Pod create requests. The
    93. RuntimeClass admission controller will reject Pod create requests which
    94. have the overhead already set. If RuntimeClass is configured and selected
    95. in the PodSpec, Overhead will be set to the value defined in the
    96. corresponding RuntimeClass, otherwise it will remain unset and treated as
    97. zero. More info:
    98. https://git.k8s.io/enhancements/keps/sig-node/20190226-pod-overhead.md This
    99. field is alpha-level as of Kubernetes v1.16, and is only honored by servers
    100. that enable the PodOverhead feature.
    101. preemptionPolicy <string>
    102. PreemptionPolicy is the Policy for preempting pods with lower priority. One
    103. of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset.
    104. This field is alpha-level and is only honored by servers that enable the
    105. NonPreemptingPriority feature.
    106. priority <integer>
    107. The priority value. Various system components use this field to find the
    108. priority of the pod. When Priority Admission Controller is enabled, it
    109. prevents users from setting this field. The admission controller populates
    110. this field from PriorityClassName. The higher the value, the higher the
    111. priority.
    112. priorityClassName <string>
    113. If specified, indicates the pod's priority. "system-node-critical" and
    114. "system-cluster-critical" are two special keywords which indicate the
    115. highest priorities with the former being the highest priority. Any other
    116. name must be defined by creating a PriorityClass object with that name. If
    117. not specified, the pod priority will be default or zero if there is no
    118. default.
    119. readinessGates <[]Object>
    120. If specified, all readiness gates will be evaluated for pod readiness. A
    121. pod is ready when all its containers are ready AND all conditions specified
    122. in the readiness gates have status equal to "True" More info:
    123. https://git.k8s.io/enhancements/keps/sig-network/0007-pod-ready%2B%2B.md
    124. restartPolicy <string>
    125. Restart policy for all containers within the pod. One of Always, OnFailure,
    126. Never. Default to Always. More info:
    127. https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
    128. runtimeClassName <string>
    129. RuntimeClassName refers to a RuntimeClass object in the node.k8s.io group,
    130. which should be used to run this pod. If no RuntimeClass resource matches
    131. the named class, the pod will not be run. If unset or empty, the "legacy"
    132. RuntimeClass will be used, which is an implicit class with an empty
    133. definition that uses the default runtime handler. More info:
    134. https://git.k8s.io/enhancements/keps/sig-node/runtime-class.md This is a
    135. beta feature as of Kubernetes v1.14.
    136. schedulerName <string>
    137. If specified, the pod will be dispatched by specified scheduler. If not
    138. specified, the pod will be dispatched by default scheduler.
    139. securityContext <Object>
    140. SecurityContext holds pod-level security attributes and common container
    141. settings. Optional: Defaults to empty. See type description for default
    142. values of each field.
    143. serviceAccount <string>
    144. DeprecatedServiceAccount is a depreciated alias for ServiceAccountName.
    145. Deprecated: Use serviceAccountName instead.
    146. serviceAccountName <string>
    147. ServiceAccountName is the name of the ServiceAccount to use to run this
    148. pod. More info:
    149. https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
    150. shareProcessNamespace <boolean>
    151. Share a single process namespace between all of the containers in a pod.
    152. When this is set containers will be able to view and signal processes from
    153. other containers in the same pod, and the first process in each container
    154. will not be assigned PID 1. HostPID and ShareProcessNamespace cannot both
    155. be set. Optional: Default to false.
    156. subdomain <string>
    157. If specified, the fully qualified Pod hostname will be
    158. "<hostname>.<subdomain>.<pod namespace>.svc.<cluster domain>". If not
    159. specified, the pod will not have a domainname at all.
    160. terminationGracePeriodSeconds <integer>
    161. Optional duration in seconds the pod needs to terminate gracefully. May be
    162. decreased in delete request. Value must be non-negative integer. The value
    163. zero indicates delete immediately. If this value is nil, the default grace
    164. period will be used instead. The grace period is the duration in seconds
    165. after the processes running in the pod are sent a termination signal and
    166. the time when the processes are forcibly halted with a kill signal. Set
    167. this value longer than the expected cleanup time for your process. Defaults
    168. to 30 seconds.
    169. tolerations <[]Object>
    170. If specified, the pod's tolerations.
    171. topologySpreadConstraints <[]Object>
    172. TopologySpreadConstraints describes how a group of pods ought to spread
    173. across topology domains. Scheduler will schedule pods in a way which abides
    174. by the constraints. This field is only honored by clusters that enable the
    175. EvenPodsSpread feature. All topologySpreadConstraints are ANDed.
    176. volumes <[]Object>
    177. List of volumes that can be mounted by containers belonging to the pod.
    178. More info: https://kubernetes.io/docs/concepts/storage/volumes
    179. [root@master ~]# kubectl explain pod.spec.containers
    180. KIND: Pod
    181. VERSION: v1
    182. RESOURCE: containers <[]Object>
    183. DESCRIPTION:
    184. List of containers belonging to the pod. Containers cannot currently be
    185. added or removed. There must be at least one container in a Pod. Cannot be
    186. updated.
    187. A single application container that you want to run within a pod.
    188. FIELDS:
    189. args <[]string>
    190. Arguments to the entrypoint. The docker image's CMD is used if this is not
    191. provided. Variable references $(VAR_NAME) are expanded using the
    192. container's environment. If a variable cannot be resolved, the reference in
    193. the input string will be unchanged. The $(VAR_NAME) syntax can be escaped
    194. with a double $$, ie: $$(VAR_NAME). Escaped references will never be
    195. expanded, regardless of whether the variable exists or not. Cannot be
    196. updated. More info:
    197. https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
    198. command <[]string>
    199. Entrypoint array. Not executed within a shell. The docker image's
    200. ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME)
    201. are expanded using the container's environment. If a variable cannot be
    202. resolved, the reference in the input string will be unchanged. The
    203. $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME).
    204. Escaped references will never be expanded, regardless of whether the
    205. variable exists or not. Cannot be updated. More info:
    206. https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
    207. env <[]Object>
    208. List of environment variables to set in the container. Cannot be updated.
    209. envFrom <[]Object>
    210. List of sources to populate environment variables in the container. The
    211. keys defined within a source must be a C_IDENTIFIER. All invalid keys will
    212. be reported as an event when the container is starting. When a key exists
    213. in multiple sources, the value associated with the last source will take
    214. precedence. Values defined by an Env with a duplicate key will take
    215. precedence. Cannot be updated.
    216. image <string>
    217. Docker image name. More info:
    218. https://kubernetes.io/docs/concepts/containers/images This field is
    219. optional to allow higher level config management to default or override
    220. container images in workload controllers like Deployments and StatefulSets.
    221. imagePullPolicy <string>
    222. Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always
    223. if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated.
    224. More info:
    225. https://kubernetes.io/docs/concepts/containers/images#updating-images
    226. lifecycle <Object>
    227. Actions that the management system should take in response to container
    228. lifecycle events. Cannot be updated.
    229. livenessProbe <Object>
    230. Periodic probe of container liveness. Container will be restarted if the
    231. probe fails. Cannot be updated. More info:
    232. https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
    233. name <string> -required-
    234. Name of the container specified as a DNS_LABEL. Each container in a pod
    235. must have a unique name (DNS_LABEL). Cannot be updated.
    236. ports <[]Object>
    237. List of ports to expose from the container. Exposing a port here gives the
    238. system additional information about the network connections a container
    239. uses, but is primarily informational. Not specifying a port here DOES NOT
    240. prevent that port from being exposed. Any port which is listening on the
    241. default "0.0.0.0" address inside a container will be accessible from the
    242. network. Cannot be updated.
    243. readinessProbe <Object>
    244. Periodic probe of container service readiness. Container will be removed
    245. from service endpoints if the probe fails. Cannot be updated. More info:
    246. https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
    247. resources <Object>
    248. Compute Resources required by this container. Cannot be updated. More info:
    249. https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
    250. securityContext <Object>
    251. Security options the pod should run with. More info:
    252. https://kubernetes.io/docs/concepts/policy/security-context/ More info:
    253. https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
    254. startupProbe <Object>
    255. StartupProbe indicates that the Pod has successfully initialized. If
    256. specified, no other probes are executed until this completes successfully.
    257. If this probe fails, the Pod will be restarted, just as if the
    258. livenessProbe failed. This can be used to provide different probe
    259. parameters at the beginning of a Pod's lifecycle, when it might take a long
    260. time to load data or warm a cache, than during steady-state operation. This
    261. cannot be updated. This is a beta feature enabled by the StartupProbe
    262. feature flag. More info:
    263. https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
    264. stdin <boolean>
    265. Whether this container should allocate a buffer for stdin in the container
    266. runtime. If this is not set, reads from stdin in the container will always
    267. result in EOF. Default is false.
    268. stdinOnce <boolean>
    269. Whether the container runtime should close the stdin channel after it has
    270. been opened by a single attach. When stdin is true the stdin stream will
    271. remain open across multiple attach sessions. If stdinOnce is set to true,
    272. stdin is opened on container start, is empty until the first client
    273. attaches to stdin, and then remains open and accepts data until the client
    274. disconnects, at which time stdin is closed and remains closed until the
    275. container is restarted. If this flag is false, a container processes that
    276. reads from stdin will never receive an EOF. Default is false
    277. terminationMessagePath <string>
    278. Optional: Path at which the file to which the container's termination
    279. message will be written is mounted into the container's filesystem. Message
    280. written is intended to be brief final status, such as an assertion failure
    281. message. Will be truncated by the node if greater than 4096 bytes. The
    282. total message length across all containers will be limited to 12kb.
    283. Defaults to /dev/termination-log. Cannot be updated.
    284. terminationMessagePolicy <string>
    285. Indicate how the termination message should be populated. File will use the
    286. contents of terminationMessagePath to populate the container status message
    287. on both success and failure. FallbackToLogsOnError will use the last chunk
    288. of container log output if the termination message file is empty and the
    289. container exited with an error. The log output is limited to 2048 bytes or
    290. 80 lines, whichever is smaller. Defaults to File. Cannot be updated.
    291. tty <boolean>
    292. Whether this container should allocate a TTY for itself, also requires
    293. 'stdin' to be true. Default is false.
    294. volumeDevices <[]Object>
    295. volumeDevices is the list of block devices to be used by the container.
    296. volumeMounts <[]Object>
    297. Pod volumes to mount into the container's filesystem. Cannot be updated.
    298. workingDir <string>
    299. Container's working directory. If not specified, the container runtime's
    300. default will be used, which might be configured in the container image.
    301. Cannot be updated.
    302. [root@master ~]#
    1. [liwm@rmaster01 ~]$ kubectl api-resources
    2. NAME SHORTNAMES APIGROUP NAMESPACED KIND
    3. bindings true Binding
    4. componentstatuses cs false ComponentStatus
    5. configmaps cm true ConfigMap
    6. endpoints ep true Endpoints
    7. events ev true Event
    8. limitranges limits true LimitRange
    9. namespaces ns false Namespace
    10. nodes no false Node
    11. persistentvolumeclaims pvc true PersistentVolumeClaim
    12. persistentvolumes pv false PersistentVolume
    13. pods po true Pod
    14. podtemplates true PodTemplate
    15. replicationcontrollers rc true ReplicationController
    16. resourcequotas quota true ResourceQuota
    17. secrets true Secret
    18. serviceaccounts sa true ServiceAccount
    19. services svc true Service
    20. mutatingwebhookconfigurations admissionregistration.k8s.io false MutatingWebhookConfiguration
    21. validatingwebhookconfigurations admissionregistration.k8s.io false ValidatingWebhookConfiguration
    22. customresourcedefinitions crd,crds apiextensions.k8s.io false CustomResourceDefinition
    23. apiservices apiregistration.k8s.io false APIService
    24. controllerrevisions apps true ControllerRevision
    25. daemonsets ds apps true DaemonSet
    26. deployments deploy apps true Deployment
    27. replicasets rs apps true ReplicaSet
    28. statefulsets sts apps true StatefulSet
    29. meshpolicies authentication.istio.io false MeshPolicy
    30. policies authentication.istio.io true Policy
    31. tokenreviews authentication.k8s.io false TokenReview
    32. localsubjectaccessreviews authorization.k8s.io true LocalSubjectAccessReview
    33. selfsubjectaccessreviews authorization.k8s.io false SelfSubjectAccessReview
    34. selfsubjectrulesreviews authorization.k8s.io false SelfSubjectRulesReview
    35. subjectaccessreviews authorization.k8s.io false SubjectAccessReview
    36. horizontalpodautoscalers hpa autoscaling true HorizontalPodAutoscaler
    37. cronjobs cj batch true CronJob
    38. jobs batch true Job
    39. certificatesigningrequests csr certificates.k8s.io false CertificateSigningRequest
    40. adapters config.istio.io true adapter
    41. attributemanifests config.istio.io true attributemanifest
    42. handlers config.istio.io true handler
    43. httpapispecbindings config.istio.io true HTTPAPISpecBinding
    44. httpapispecs config.istio.io true HTTPAPISpec
    45. instances config.istio.io true instance
    46. quotaspecbindings config.istio.io true QuotaSpecBinding
    47. quotaspecs config.istio.io true QuotaSpec
    48. rules config.istio.io true rule
    49. templates config.istio.io true template
    50. leases coordination.k8s.io true Lease
    51. bgpconfigurations crd.projectcalico.org false BGPConfiguration
    52. bgppeers crd.projectcalico.org false BGPPeer
    53. blockaffinities crd.projectcalico.org false BlockAffinity
    54. clusterinformations crd.projectcalico.org false ClusterInformation
    55. felixconfigurations crd.projectcalico.org false FelixConfiguration
    56. globalnetworkpolicies crd.projectcalico.org false GlobalNetworkPolicy
    57. globalnetworksets crd.projectcalico.org false GlobalNetworkSet
    58. hostendpoints crd.projectcalico.org false HostEndpoint
    59. ipamblocks crd.projectcalico.org false IPAMBlock
    60. ipamconfigs crd.projectcalico.org false IPAMConfig
    61. ipamhandles crd.projectcalico.org false IPAMHandle
    62. ippools crd.projectcalico.org false IPPool
    63. networkpolicies crd.projectcalico.org true NetworkPolicy
    64. networksets crd.projectcalico.org true NetworkSet
    65. endpointslices discovery.k8s.io true EndpointSlice
    66. events ev events.k8s.io true Event
    67. ingresses ing extensions true Ingress
    68. nodes metrics.k8s.io false NodeMetrics
    69. pods metrics.k8s.io true PodMetrics
    70. alertmanagers monitoring.coreos.com true Alertmanager
    71. podmonitors monitoring.coreos.com true PodMonitor
    72. prometheuses monitoring.coreos.com true Prometheus
    73. prometheusrules monitoring.coreos.com true PrometheusRule
    74. servicemonitors monitoring.coreos.com true ServiceMonitor
    75. destinationrules dr networking.istio.io true DestinationRule
    76. envoyfilters networking.istio.io true EnvoyFilter
    77. gateways gw networking.istio.io true Gateway
    78. serviceentries se networking.istio.io true ServiceEntry
    79. sidecars networking.istio.io true Sidecar
    80. virtualservices vs networking.istio.io true VirtualService
    81. ingresses ing networking.k8s.io true Ingress
    82. networkpolicies netpol networking.k8s.io true NetworkPolicy
    83. runtimeclasses node.k8s.io false RuntimeClass
    84. poddisruptionbudgets pdb policy true PodDisruptionBudget
    85. podsecuritypolicies psp policy false PodSecurityPolicy
    86. clusterrolebindings rbac.authorization.k8s.io false ClusterRoleBinding
    87. clusterroles rbac.authorization.k8s.io false ClusterRole
    88. rolebindings rbac.authorization.k8s.io true RoleBinding
    89. roles rbac.authorization.k8s.io true Role
    90. clusterrbacconfigs rbac.istio.io false ClusterRbacConfig
    91. rbacconfigs rbac.istio.io true RbacConfig
    92. servicerolebindings rbac.istio.io true ServiceRoleBinding
    93. serviceroles rbac.istio.io true ServiceRole
    94. priorityclasses pc scheduling.k8s.io false PriorityClass
    95. authorizationpolicies security.istio.io true AuthorizationPolicy
    96. csidrivers storage.k8s.io false CSIDriver
    97. csinodes storage.k8s.io false CSINode
    98. storageclasses sc storage.k8s.io false StorageClass
    99. volumeattachments storage.k8s.io false VolumeAttachment
    100. [liwm@rmaster01 ~]$

    就绪

    1. apiVersion: v1
    2. kind: Pod
    3. metadata:
    4. name: readiness-httpget-pod
    5. namespace: default
    6. spec:
    7. containers:
    8. - name: readiness-httpget-container
    9. image: nginx
    10. imagePullPolicy: IfNotPresent
    11. ports:
    12. - name: http
    13. containerPort: 80
    14. readinessProbe:
    15. httpGet:
    16. port: http
    17. path: /index.html
    18. initialDelaySeconds: 1
    19. timeoutSeconds: 3

    作业:
    1.了解Kubernts 能为我们解决什么 ?
    2.掌握Kubernts 的概念
    3.安装Kubernts 集群
    4.搭建HA模式的Kubernts 集群
    5.INT Pod的使用场景
    6.[Web+Rdis 方式]部署
    7.Pause 容器的概念以应用