没有合适的资源?快使用搜索试试~ 我知道了~
首页LFD259官方实验手册:Kubernetes开发者指南 (2019年版)
LFD259官方实验手册:Kubernetes开发者指南 (2019年版)
需积分: 9 0 下载量 148 浏览量
更新于2024-07-15
收藏 517KB PDF 举报
LFD259-labs_V2019-03-11 官方实验手册是一份由Linux Foundation(LF)发布的针对开发人员的 Kubernetes 学习资料。该手册于 2019 年 3 月 11 日更新,版权全归 Linux Foundation 所有,所有权利受到保护。课程材料包括教学内容和开发成果,均受版权法和知识产权法律约束。 手册中的开源代码遵循相应的许可证进行使用,这意味着参与者可以在个人学习过程中使用这些代码,但禁止未经 Linux Foundation 的书面许可进行复制、修改或分发给非参与者,或者用作提供培训他人的工具。任何对本手册内容或使用的声明,无论是明示还是暗示,都不涉及关于内容完整性的保证,也不承诺商品质量。 这份出版物仅限于在得到明确书面同意的情况下进行复制、打印、存储于检索系统或传输。Linux Foundation 是该文档的出版者,可以通过其官方网站 <https://www.linuxfoundation.org> 获取更多信息。因此,LFD259-labs 提供的是一种定制化的学习资源,旨在帮助开发者深入了解 Kubernetes 技术,并确保合法和合规的学习环境。它可能包含关于 Kubernetes 的基础概念、集群管理、服务部署、容器编排以及与之相关的最佳实践案例。通过深入的实验和实践,参与者能够提升自己在云计算领域的能力,并熟悉如何在实际项目中应用 Kubernetes。
资源详情
资源推荐
12 CHAPTER 2. KUBERNETES ARCHITECTURE
3. View the details of the deployment, then the pod. Work through the output slowly. Knowing what a healthy deployment
and looks like can be helpful when troubleshooting issues. Again the Tab key can be helpful when using long auto-
generated object names. You should be able to type firstpodTab and the name will complete when viewing the pod.
student@ckad-1:~$ kubectl describe deployment firstpod
Name: firstpod
Namespace: default
CreationTimestamp: Fri, 25 Jul 2018 16:46:57 +0000
Labels: run=firstpod
Annotations: deployment.kubernetes.io/revision=1
Selector: run=firstpod
Replicas: 1 desired | 1 updated | 1 total | 1 available....
StrategyType: RollingUpdate
MinReadySeconds: 0
<output_omitted>
student@ckad-1:~$ kubectl describe pod firstpod-6bb4574d94-rqk76
Name: firstpod-6bb4574d94-rqk76
Namespace: default
Priority: 0
PriorityClassName: <none>
Node: ckad-1/10.128.0.2
Start Time: Wed, 25 Jul 2018 06:13:18 +0000
Labels: pod-template-hash=2660130850
run=firstpod
Annotations: <none>
Status: Running
IP: 192.168.200.65
Controlled By: ReplicaSet/firstpod-6bb4574d94
<output_omitted>
4. Note that the resources are in the default namespace. Get a list of available namespaces.
student@ckad-1:~$ kubectl get namespaces
NAME STATUS AGE
default Active 20m
kube-public Active 20m
kube-system Active 20m
5. There are two other namespaces. Look at the pods in the kube-system namespace.
student@ckad-1:~$ kubectl get pod -n kube-system
NAME READY STATUS RESTARTS AGE
calico-etcd-rvrpk 1/1 Running 1 20m
calico-kube-controllers-d554689d5-lm687 1/1 Running 1 20m
calico-node-2ck9g 2/2 Running 4 19m
calico-node-kkxvl 2/2 Running 3 20m
etcd-ckad-1 1/1 Running 1 20m
<output_omitted>
6. Now look at the pods in a namespace that does not exist. Note you do not receive an error.
student@ckad-1:~$ kubectl get pod -n fakenamespace
No resources found.
7. You can also view resources in all namespaces at once. Use the --all-namespaces options to select objects in all
namespaces at once.
student@ckad-1:~$ kubectl get pod --all-namespaces
LFD259: V 2019-03-11 © Copyright the Linux Foundation 2019. All rights reserved.
13
NAMESPACE NAME READY STATUS RESTARTS AGE
default firstpod-6bb4574d94-rqk76 1/1 Running 0 5m
kube-system calico-etcd-z49kx 1/1 Running 0 31m
kube-system calico-kube-controllers-d554689d5-pfszw 1/1 Running 0 31m
<output_omitted>
8. View several resources at once. Note that most resources have a short name such as rs for ReplicaSet, po for Pod,
svc for Service, and ep for endpoint. Note the endpoint still exists after we deleted the pod.
student@ckad-1:~$ kubectl get deploy,rs,po,svc,ep
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.extensions/firstpod 1/1 1 1 4m
NAME DESIRED CURRENT READY....
replicaset.extensions/firstpod-6bb4574d94-rqk76 1 1 1 ....
NAME READY STATUS RESTARTS AGE
pod/firstpod-6bb4574d94-rqk76 1/1 Running 0 4m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/basicservice NodePort 10.108.147.76 <none> 80:31601/TCP 21m
service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 21m
NAME ENDPOINTS AGE
endpoints/basicservice <none> 21m
endpoints/kubernetes 10.128.0.3:6443 21m
9. Delete the ReplicaSet and view the resources again. Note that the age on the ReplicaSet and the pod it controls is
now less than a minute. The deployment controller started a new ReplicaSet when we deleted the existing one, which
started another pod when the desired configuration did not match the current status.
student@ckad-1:~$ kubectl delete rs firstpod-6bb4574d94-rqk76
replicaset.extensions "firstpod-6bb4574d94-rqk76" deleted
student@ckad-1:~$ kubectl get deployment,rs,po,svc,ep
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.extensions/firstpod 1/1 1 1 7m
NAME DESIRED CURRENT....
replicaset.extensions/firstpod-6bb4574d94-rqk76 1 1 ....
NAME READY STATUS RESTARTS AGE
pod/firstpod-7d99ffc75-p9hbw 1/1 Running 0 12s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 24m
NAME ENDPOINTS AGE
endpoints/kubernetes 10.128.0.2:6443 80m
endpoints/basicservice <none> 21m
10. This time delete the top-level controller. After about 30 seconds for everything to shut down you should only see the
cluster service and endpoint remain for the cluster and the service we created.
student@ckad-1:~$ kubectl delete deployment firstpod
deployment.extensions "firstpod" deleted
student@ckad-1:~$ kubectl get deployment,rs,po,svc,ep
LFD259: V 2019-03-11 © Copyright the Linux Foundation 2019. All rights reserved.
14 CHAPTER 2. KUBERNETES ARCHITECTURE
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/basicservice NodePort 10.108.147.76 <none> 80:31601/TCP 35m
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 24m
NAME ENDPOINTS AGE
endpoints/basicservice <none> 21m
kubernetes 10.128.0.3:6443 24m
11. As we won’t need it for a while, delete the basicservice service as well.
student@ckad-1:~$ kubectl delete svc basicservice
service "basicservice" deleted
LFD259: V 2019-03-11 © Copyright the Linux Foundation 2019. All rights reserved.
Chapter 3
Build
Exercise 3.1: Deploy a New Application
Overview
In this lab we will deploy a very simple Python application, test it using Docker, ingest it into Kubernetes and con-
figure probes to ensure it continues to run. This lab requires the completion of the previous lab, the installation and
configuration of a Kubernetes cluster.
Working with Python
1. Install python on your master node. It may already be installed, as is shown in the output below.
student@ckad-1:~$ sudo apt-get -y install python
Reading package lists... Done
Building dependency tree
Reading state information... Done
python is already the newest version (2.7.12-1~16.04).
python set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
student@ckad-1:~$
2. Locate the python binary on your system.
student@ckad-1:~$ which python
/usr/bin/python
3. Create and change into a new directory. The Docker build process pulls everything from the current directory into the
image file by default. Make sure the chosen directory is empty.
student@ckad-1:~$ mkdir app1
student@ckad-1:~$ cd app1
student@ckad-1:~/app1$ ls -l
total 0
15
剩余93页未读,继续阅读
gaoyidong
- 粉丝: 2
- 资源: 29
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 最优条件下三次B样条小波边缘检测算子研究
- 深入解析:wav文件格式结构
- JIRA系统配置指南:代理与SSL设置
- 入门必备:电阻电容识别全解析
- U盘制作启动盘:详细教程解决无光驱装系统难题
- Eclipse快捷键大全:提升开发效率的必备秘籍
- C++ Primer Plus中文版:深入学习C++编程必备
- Eclipse常用快捷键汇总与操作指南
- JavaScript作用域解析与面向对象基础
- 软通动力Java笔试题解析
- 自定义标签配置与使用指南
- Android Intent深度解析:组件通信与广播机制
- 增强MyEclipse代码提示功能设置教程
- x86下VMware环境中Openwrt编译与LuCI集成指南
- S3C2440A嵌入式终端电源管理系统设计探讨
- Intel DTCP-IP技术在数字家庭中的内容保护
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功