Introduction
Core Concepts
Joseph
2022/4/9
Agenda
• k8s有哪些東西
• Pod
• Replica set
• Deployment
• Service
• Cluster architecture
• High level 視角
• 以容器的形式 自動地維持服務
• 部署多個服務
k8s high level
• 架構
• 比喻貨櫃公司&船隻運貨
• (ship=worker node) 放了一些容器貨櫃
• Master 管理: 船隻監控與追蹤
• Key-value store : etcd cluster
• Scheduler
• 排程、分派
• Node-controller
• 監視node健康度 (不可用、壞了)
• Replication –controller
• 是否滿足定義的數量
• Api-server
• 對外暴露
• 定時要Kubelet回報狀態
• Kubelet 船長 (每個node)
• 確保載正確的容器、回報狀態 給master
• 聽api-server的指令,加載卸載 容器
• Kube-proxy
• 確保跨船通信
CKA_1st.pptx
k8s與docker的關聯
• Docker
• 用來跑容器
• 裝在所有node
• 替代方案:ContainerD, Rocket
ETCD
Port: 2379
ETCDCTL Utility
• 版本:2, 3 是獨立分開的(不互相支援)、預設是2
• ETCDCTL is the CLI tool used to interact with ETCD.
ETCDCTL can interact with ETCD Server using 2 API versions - Version 2 and Version 3. By default its set to use Version 2. Each
version has different sets of commands.
• For example ETCDCTL version 2 supports the following commands:
• etcdctl backup
• etcdctl cluster-health
• etcdctl mk
• etcdctl mkdir
• etcdctl set
• Whereas the commands are different in version 3
• etcdctl snapshot save
• etcdctl endpoint health
• etcdctl get
• etcdctl put
• To set the right version of API set the environment variable ETCDCTL_API command
• export ETCDCTL_API=3
ETCD Cont.
• When API version is not set, it is assumed to be set to version 2. And version 3 commands listed above don't
work. When API version is set to version 3, version 2 commands listed above don't work.
•
• Apart from that, you must also specify path to certificate files so that ETCDCTL can authenticate to the
ETCD API Server. The certificate files are available in the etcd-master at the following path. We discuss more
about certificates in the security section of this course. So don't worry if this looks complex:
• --cacert /etc/kubernetes/pki/etcd/ca.crt
• --cert /etc/kubernetes/pki/etcd/server.crt
• --key /etc/kubernetes/pki/etcd/server.key
•
• specify the ETCDCTL API version and path to certificate files. Below is the final form:
• kubectl exec etcd-master -n kube-system -- sh -c "ETCDCTL_API=3 etcdctl get / --prefix --keys-only --limit=10 --cacert
/etc/kubernetes/pki/etcd/ca.crt --cert /etc/kubernetes/pki/etcd/server.crt --key /etc/kubernetes/pki/etcd/server.key"
Kubectl
• Kubectl cmd  API Server ETCD
Controller manager
• Monitor status
• 有各式各樣的Controller
Kube-scheduler
• 決定讓pod去最適當的node
Kubelet
• 船長
• 要求docker下載image並執行
Kube-proxy
• Deployed as daemon set
• Pod相當於application(Udemy主講說,但。。)
• 一個pod可以有多個container
• Share resources
• 可以網路直連
• 高可用(LB)的創建方式
創建pod
• Create a pod
• YAML主結構
CKA_1st.pptx
Pratice (在後半段)
• accessing the labs
ReplicaSets
• Replica Sets 可以說是進化版的Replication
Controller,與Replication Controller最大的差異在
於,Replica Sets 提供了 更彈性的selector 。
ReplicaSets (cont.)
CKA_1st.pptx
Deployment
• 自動產生
• replicaSet, pod
Certification Tip!
• Create an NGINX Pod
• kubectl run nginx --image=nginx
• Generate POD Manifest YAML file (-o yaml). Don't create it(--dry-run)
• kubectl run nginx --image=nginx --dry-run=client -o yaml
• Create a deployment
• kubectl create deployment --image=nginx nginx
• Generate Deployment YAML file (-o yaml). Don't create it(--dry-run)
• kubectl create deployment --image=nginx nginx --dry-run=client -o yaml
• Generate Deployment YAML file (-o yaml). Don't create it(--dry-run) with 4 Replicas (--replicas=4)
• kubectl create deployment --image=nginx nginx --dry-run=client -o yaml > nginx-deployment.yaml
• Save it to a file, make necessary changes to the file (for example, adding more replicas) and then create the deployment.
• kubectl create -f nginx-deployment.yaml
• OR
• In k8s version 1.19+, we can specify the --replicas option to create a deployment with 4 replicas.
• kubectl create deployment --image=nginx nginx --replicas=4 --dry-run=client -o yaml > nginx-deployment.yaml
Live demo
Pod 實操
• https://kodekloud.com/topic/practice-test-pods-2/
• controlplane ~ ➜ kubectl run nginx --image=nginx
• pod/nginx created
• controlplane ~ ➜ kubectl describe pod newpods-bk6fb
• controlplane ~ ➜ kubectl get pods -o=wide
• How many containers are part of the pod webapp?
• =>kubectl get pods -o=wide
• What images are used in the new webapp pod?
• =>kubectl describe pod webapp
• Delete the webapp Pod.
• ==>
• controlplane ~ ➜ kubectl delete pod webapp
• pod "webapp" deleted
• Create a new pod with the name redis and with the image redis123.
• controlplane ~ ➜ kubectl create -f redis.yaml
• pod/redis created
• Now change the image on this pod to redis.
• Once done, the pod should be in a running state.
• controlplane ~ ➜ vi redis.yaml
• controlplane ~ ➜ kubectl apply -f redis.yaml
、
CKA_1st.pptx
CKA_1st.pptx
CKA_1st.pptx
CKA_1st.pptx
CKA_1st.pptx
CKA_1st.pptx
PRACTICE TEST –
REPLICASETS
kubectl get rs
kubectl describe rs new-replica-set
kubectl describe pod new-replica-set-nd9q4
kubectl delete pod new-replica-set-nd9q4
kubectl apply -f replicaset-definition-1.yaml
kubectl delete rs replicaset-1
kubectl edit rs new-replica-set
kubectl delete pod new-replica-set-t2fg8 new-replica-set-zrjwp new-replica-set-gmlsd new-replica-set-6wwwb
kubectl scale rs new-replica-set --replicas=5
CKA_1st.pptx
CKA_1st.pptx
CKA_1st.pptx
RS ensures that desired number of PODs run
apiVersion: apps/v1
tier: frontend 找label
kubectl delete rs replicaset-1
kubectl edit rs new-replica-set
kubectl scale rs new-replica-set --replicas=5
PRACTICE TESTS –
DEPLOYMENTS
kubectl get deployments
kubectl apply -f deployment-definition-1.yaml
kubectl create deployment httpd-frontend --image=httpd:2.4-alpine
kubectl scale deployment httpd-frontend --replicas=3
kind: Deployment
kubectl create deployment httpd-frontend --
image=httpd:2.4-alpine
PRACTICE TEST NAMESPACES
kubectl get ns
kubectl get pod -n research
kubectl describe pod -n research
kubectl run redis --image=redis --dry-run=client -o yaml > pod.yaml
kubectl get pod --all-namespaces
kubectl get pod --all-namespaces | grep blue
kubectl get ns
kubectl get pod -n research
kubectl describe pod -n research
• Create a POD in the finance namespace.
• Use the spec given below.
• Name: redis
• Image Name: redis
• (X) kubectl run redis --image=redis
• Not in the finance namespace.
• kubectl run redis --image=redis
• --dry-run=client -o yaml > pod.yaml
kubectl get pod --all-namespaces
• 直接使用”db-service”可以直接訪問
• 但如果是要訪問別的namespace的
• Ex: dev底下的db-service
• db-service.dev.svc.cluster.local
PRACTICE TEST SERVICES
kubectl get svc
kubectl describe svc Kubernetes
kubectl get deploy
• Default is clusterIP type
• kubectl describe svc kubernetes
• TargetPort, Labels, Endpoints
Access the web application using
the tab 'simple-webapp-ui' above
the terminal window.
• Create a new service to access the web application using the service-
definition-1.yaml file
•
Name: webapp-service
Type: NodePort
targetPort: 8080
port: 8080
nodePort: 30080
selector: simple-webapp
PRACTICE TEST –
IMPERATIVE COMMANDS
kubectl run nginx-pod --image=nginx:alpine
kubectl run redis --image=redis:alpine --labels=tier=db
kubectl expose pod redis --name=redis-service --port=6379 --target-port=6379
kubectl create deploy webapp --image=kodekloud/webapp-color
kubectl run custom-nginx --image=nginx --port=8080
kubectl create ns dev-ns
kubectl expose pod httpd --name=httpd --target-port=80 --port=80
apply –f XXX.yaml
• kubectl run nginx-pod --image=nginx:alpine
• kubectl run redis --image=redis:alpine --dry-run=client -o yaml >
redis.yaml 然後 labels加上tier:db 或者
• kubectl run redis --image=redis:alpine –labels=tier=db
CKA_1st.pptx
kubectl expose pod redis --name=redis-
service --port=6379 --target-port=6379
kubectl create deploy webapp --
image=kodekloud/webapp-color
• create deploy不用加--name=
kubectl run custom-nginx --image=nginx --
port=8080
kubectl create ns dev-ns
• create deploy不用加--name=
• 不能使用--replics=N
kubectl expose pod 必須同時有--target-
port=80 --port=80

More Related Content

PDF
Kubernetes - introduction
PDF
Kubernetes 101
PDF
Hands-On Introduction to Kubernetes at LISA17
PPTX
Kubernetes Introduction
PDF
Kubernetes: A Short Introduction (2019)
PDF
Architecture Overview: Kubernetes with Red Hat Enterprise Linux 7.1
PDF
DevJam 2019 - Introduction to Kubernetes
PDF
Autoscaling Kubernetes
Kubernetes - introduction
Kubernetes 101
Hands-On Introduction to Kubernetes at LISA17
Kubernetes Introduction
Kubernetes: A Short Introduction (2019)
Architecture Overview: Kubernetes with Red Hat Enterprise Linux 7.1
DevJam 2019 - Introduction to Kubernetes
Autoscaling Kubernetes

What's hot (20)

PDF
Kubernetes 101
PPTX
Introduction to kubernetes
PDF
CKA Certified Kubernetes Administrator Notes
PPTX
Kubernetes
PDF
Kubernetes Introduction
PDF
Kubernetes architecture
PPTX
Kubernetes for Beginners: An Introductory Guide
PDF
Kubernetes Basics
PPTX
01. Kubernetes-PPT.pptx
PPTX
Spring Boot+Kafka: the New Enterprise Platform
PDF
Quick introduction to Kubernetes
PDF
Kubernetes - A Comprehensive Overview
PDF
Introduction to Kubernetes Workshop
PDF
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
PDF
Introduction to Docker Compose
PDF
An Introduction to Kubernetes
PDF
Kubernetes
PDF
Getting Started with Kubernetes
PDF
Kubernetes security
PDF
[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축
Kubernetes 101
Introduction to kubernetes
CKA Certified Kubernetes Administrator Notes
Kubernetes
Kubernetes Introduction
Kubernetes architecture
Kubernetes for Beginners: An Introductory Guide
Kubernetes Basics
01. Kubernetes-PPT.pptx
Spring Boot+Kafka: the New Enterprise Platform
Quick introduction to Kubernetes
Kubernetes - A Comprehensive Overview
Introduction to Kubernetes Workshop
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
Introduction to Docker Compose
An Introduction to Kubernetes
Kubernetes
Getting Started with Kubernetes
Kubernetes security
[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축
Ad

Similar to CKA_1st.pptx (20)

PDF
Continuous Deployment with Kubernetes, Docker and GitLab CI
PPTX
KuberneteSADASDSADASDASDASDASDASDAs Labs.pptx
PDF
Pro2516 10 things about oracle and k8s.pptx-final
PDF
Docker kubernetes fundamental(pod_service)_190307
PDF
Enjoying k8s cluster with Minikube and Helm
PDF
Kubernetes Walk Through from Technical View
PDF
From Kubernetes to OpenStack in Sydney
PPTX
GlobalAzureBootCamp 2018
PPTX
Microservices with containers in the cloud
PDF
Bdc from bare metal to k8s
PPTX
K8s in 3h - Kubernetes Fundamentals Training
PDF
Introduction to Kubernetes RBAC
PPTX
Kube Overview and Kube Conformance Certification OpenSource101 Raleigh
PDF
Kubernetes Problem-Solving
PDF
Container orchestration k8s azure kubernetes services
PDF
Building Out Your Kafka Developer CDC Ecosystem
PDF
Kubernetes Networking
PDF
Kubeflow control plane
PDF
Docker and Puppet for Continuous Integration
PDF
PGConf.ASIA 2019 Bali - Building PostgreSQL as a Service with Kubernetes - Ta...
Continuous Deployment with Kubernetes, Docker and GitLab CI
KuberneteSADASDSADASDASDASDASDASDAs Labs.pptx
Pro2516 10 things about oracle and k8s.pptx-final
Docker kubernetes fundamental(pod_service)_190307
Enjoying k8s cluster with Minikube and Helm
Kubernetes Walk Through from Technical View
From Kubernetes to OpenStack in Sydney
GlobalAzureBootCamp 2018
Microservices with containers in the cloud
Bdc from bare metal to k8s
K8s in 3h - Kubernetes Fundamentals Training
Introduction to Kubernetes RBAC
Kube Overview and Kube Conformance Certification OpenSource101 Raleigh
Kubernetes Problem-Solving
Container orchestration k8s azure kubernetes services
Building Out Your Kafka Developer CDC Ecosystem
Kubernetes Networking
Kubeflow control plane
Docker and Puppet for Continuous Integration
PGConf.ASIA 2019 Bali - Building PostgreSQL as a Service with Kubernetes - Ta...
Ad

Recently uploaded (20)

PDF
AIGA 012_04 Cleaning of equipment for oxygen service_reformat Jan 12.pdf
PDF
Using Technology to Foster Innovative Teaching Practices (www.kiu.ac.ug)
PPTX
DATA STRCUTURE LABORATORY -BCSL305(PRG1)
PPTX
Software-Development-Life-Cycle-SDLC.pptx
PPTX
SC Robotics Team Safety Training Presentation
PPTX
SE unit 1.pptx by d.y.p.akurdi aaaaaaaaaaaa
PDF
Software defined netwoks is useful to learn NFV and virtual Lans
PDF
Engineering Solutions for Ethical Dilemmas in Healthcare (www.kiu.ac.ug)
PDF
IAE-V2500 Engine for Airbus Family 319/320
PDF
MACCAFERRY GUIA GAVIONES TERRAPLENES EN ESPAÑOL
PDF
electrical machines course file-anna university
PPTX
AI-Reporting for Emerging Technologies(BS Computer Engineering)
PPT
UNIT-I Machine Learning Essentials for 2nd years
PPTX
SE unit 1.pptx aaahshdhajdviwhsiehebeiwheiebeiev
PDF
Artificial Intelligence_ Basics .Artificial Intelligence_ Basics .
PDF
Performance, energy consumption and costs: a comparative analysis of automati...
PDF
Beginners-Guide-to-Artificial-Intelligence.pdf
PPT
Programmable Logic Controller PLC and Industrial Automation
PDF
Lesson 3 .pdf
PPTX
chapter 1.pptx dotnet technology introduction
AIGA 012_04 Cleaning of equipment for oxygen service_reformat Jan 12.pdf
Using Technology to Foster Innovative Teaching Practices (www.kiu.ac.ug)
DATA STRCUTURE LABORATORY -BCSL305(PRG1)
Software-Development-Life-Cycle-SDLC.pptx
SC Robotics Team Safety Training Presentation
SE unit 1.pptx by d.y.p.akurdi aaaaaaaaaaaa
Software defined netwoks is useful to learn NFV and virtual Lans
Engineering Solutions for Ethical Dilemmas in Healthcare (www.kiu.ac.ug)
IAE-V2500 Engine for Airbus Family 319/320
MACCAFERRY GUIA GAVIONES TERRAPLENES EN ESPAÑOL
electrical machines course file-anna university
AI-Reporting for Emerging Technologies(BS Computer Engineering)
UNIT-I Machine Learning Essentials for 2nd years
SE unit 1.pptx aaahshdhajdviwhsiehebeiwheiebeiev
Artificial Intelligence_ Basics .Artificial Intelligence_ Basics .
Performance, energy consumption and costs: a comparative analysis of automati...
Beginners-Guide-to-Artificial-Intelligence.pdf
Programmable Logic Controller PLC and Industrial Automation
Lesson 3 .pdf
chapter 1.pptx dotnet technology introduction

CKA_1st.pptx

  • 2. Agenda • k8s有哪些東西 • Pod • Replica set • Deployment • Service • Cluster architecture • High level 視角 • 以容器的形式 自動地維持服務 • 部署多個服務
  • 3. k8s high level • 架構 • 比喻貨櫃公司&船隻運貨 • (ship=worker node) 放了一些容器貨櫃 • Master 管理: 船隻監控與追蹤 • Key-value store : etcd cluster • Scheduler • 排程、分派 • Node-controller • 監視node健康度 (不可用、壞了) • Replication –controller • 是否滿足定義的數量 • Api-server • 對外暴露 • 定時要Kubelet回報狀態 • Kubelet 船長 (每個node) • 確保載正確的容器、回報狀態 給master • 聽api-server的指令,加載卸載 容器 • Kube-proxy • 確保跨船通信
  • 5. k8s與docker的關聯 • Docker • 用來跑容器 • 裝在所有node • 替代方案:ContainerD, Rocket
  • 7. ETCDCTL Utility • 版本:2, 3 是獨立分開的(不互相支援)、預設是2 • ETCDCTL is the CLI tool used to interact with ETCD. ETCDCTL can interact with ETCD Server using 2 API versions - Version 2 and Version 3. By default its set to use Version 2. Each version has different sets of commands. • For example ETCDCTL version 2 supports the following commands: • etcdctl backup • etcdctl cluster-health • etcdctl mk • etcdctl mkdir • etcdctl set • Whereas the commands are different in version 3 • etcdctl snapshot save • etcdctl endpoint health • etcdctl get • etcdctl put • To set the right version of API set the environment variable ETCDCTL_API command • export ETCDCTL_API=3
  • 8. ETCD Cont. • When API version is not set, it is assumed to be set to version 2. And version 3 commands listed above don't work. When API version is set to version 3, version 2 commands listed above don't work. • • Apart from that, you must also specify path to certificate files so that ETCDCTL can authenticate to the ETCD API Server. The certificate files are available in the etcd-master at the following path. We discuss more about certificates in the security section of this course. So don't worry if this looks complex: • --cacert /etc/kubernetes/pki/etcd/ca.crt • --cert /etc/kubernetes/pki/etcd/server.crt • --key /etc/kubernetes/pki/etcd/server.key • • specify the ETCDCTL API version and path to certificate files. Below is the final form: • kubectl exec etcd-master -n kube-system -- sh -c "ETCDCTL_API=3 etcdctl get / --prefix --keys-only --limit=10 --cacert /etc/kubernetes/pki/etcd/ca.crt --cert /etc/kubernetes/pki/etcd/server.crt --key /etc/kubernetes/pki/etcd/server.key"
  • 9. Kubectl • Kubectl cmd  API Server ETCD
  • 10. Controller manager • Monitor status • 有各式各樣的Controller
  • 14. • Pod相當於application(Udemy主講說,但。。) • 一個pod可以有多個container • Share resources • 可以網路直連 • 高可用(LB)的創建方式
  • 15. 創建pod • Create a pod • YAML主結構
  • 18. ReplicaSets • Replica Sets 可以說是進化版的Replication Controller,與Replication Controller最大的差異在 於,Replica Sets 提供了 更彈性的selector 。
  • 22. Certification Tip! • Create an NGINX Pod • kubectl run nginx --image=nginx • Generate POD Manifest YAML file (-o yaml). Don't create it(--dry-run) • kubectl run nginx --image=nginx --dry-run=client -o yaml • Create a deployment • kubectl create deployment --image=nginx nginx • Generate Deployment YAML file (-o yaml). Don't create it(--dry-run) • kubectl create deployment --image=nginx nginx --dry-run=client -o yaml • Generate Deployment YAML file (-o yaml). Don't create it(--dry-run) with 4 Replicas (--replicas=4) • kubectl create deployment --image=nginx nginx --dry-run=client -o yaml > nginx-deployment.yaml • Save it to a file, make necessary changes to the file (for example, adding more replicas) and then create the deployment. • kubectl create -f nginx-deployment.yaml • OR • In k8s version 1.19+, we can specify the --replicas option to create a deployment with 4 replicas. • kubectl create deployment --image=nginx nginx --replicas=4 --dry-run=client -o yaml > nginx-deployment.yaml
  • 24. Pod 實操 • https://kodekloud.com/topic/practice-test-pods-2/ • controlplane ~ ➜ kubectl run nginx --image=nginx • pod/nginx created • controlplane ~ ➜ kubectl describe pod newpods-bk6fb • controlplane ~ ➜ kubectl get pods -o=wide
  • 25. • How many containers are part of the pod webapp? • =>kubectl get pods -o=wide • What images are used in the new webapp pod? • =>kubectl describe pod webapp • Delete the webapp Pod. • ==> • controlplane ~ ➜ kubectl delete pod webapp • pod "webapp" deleted • Create a new pod with the name redis and with the image redis123.
  • 26. • controlplane ~ ➜ kubectl create -f redis.yaml • pod/redis created • Now change the image on this pod to redis. • Once done, the pod should be in a running state. • controlplane ~ ➜ vi redis.yaml • controlplane ~ ➜ kubectl apply -f redis.yaml
  • 27.
  • 34. PRACTICE TEST – REPLICASETS kubectl get rs kubectl describe rs new-replica-set kubectl describe pod new-replica-set-nd9q4 kubectl delete pod new-replica-set-nd9q4 kubectl apply -f replicaset-definition-1.yaml kubectl delete rs replicaset-1 kubectl edit rs new-replica-set kubectl delete pod new-replica-set-t2fg8 new-replica-set-zrjwp new-replica-set-gmlsd new-replica-set-6wwwb kubectl scale rs new-replica-set --replicas=5
  • 38. RS ensures that desired number of PODs run
  • 41. kubectl delete rs replicaset-1
  • 42. kubectl edit rs new-replica-set
  • 43. kubectl scale rs new-replica-set --replicas=5
  • 44. PRACTICE TESTS – DEPLOYMENTS kubectl get deployments kubectl apply -f deployment-definition-1.yaml kubectl create deployment httpd-frontend --image=httpd:2.4-alpine kubectl scale deployment httpd-frontend --replicas=3
  • 46. kubectl create deployment httpd-frontend -- image=httpd:2.4-alpine
  • 47. PRACTICE TEST NAMESPACES kubectl get ns kubectl get pod -n research kubectl describe pod -n research kubectl run redis --image=redis --dry-run=client -o yaml > pod.yaml kubectl get pod --all-namespaces kubectl get pod --all-namespaces | grep blue
  • 48. kubectl get ns kubectl get pod -n research
  • 49. kubectl describe pod -n research • Create a POD in the finance namespace. • Use the spec given below. • Name: redis • Image Name: redis • (X) kubectl run redis --image=redis • Not in the finance namespace. • kubectl run redis --image=redis • --dry-run=client -o yaml > pod.yaml
  • 50. kubectl get pod --all-namespaces
  • 51. • 直接使用”db-service”可以直接訪問 • 但如果是要訪問別的namespace的 • Ex: dev底下的db-service • db-service.dev.svc.cluster.local
  • 52. PRACTICE TEST SERVICES kubectl get svc kubectl describe svc Kubernetes kubectl get deploy
  • 53. • Default is clusterIP type • kubectl describe svc kubernetes • TargetPort, Labels, Endpoints
  • 54. Access the web application using the tab 'simple-webapp-ui' above the terminal window. • Create a new service to access the web application using the service- definition-1.yaml file • Name: webapp-service Type: NodePort targetPort: 8080 port: 8080 nodePort: 30080 selector: simple-webapp
  • 55. PRACTICE TEST – IMPERATIVE COMMANDS kubectl run nginx-pod --image=nginx:alpine kubectl run redis --image=redis:alpine --labels=tier=db kubectl expose pod redis --name=redis-service --port=6379 --target-port=6379 kubectl create deploy webapp --image=kodekloud/webapp-color kubectl run custom-nginx --image=nginx --port=8080 kubectl create ns dev-ns kubectl expose pod httpd --name=httpd --target-port=80 --port=80
  • 56. apply –f XXX.yaml • kubectl run nginx-pod --image=nginx:alpine • kubectl run redis --image=redis:alpine --dry-run=client -o yaml > redis.yaml 然後 labels加上tier:db 或者 • kubectl run redis --image=redis:alpine –labels=tier=db
  • 58. kubectl expose pod redis --name=redis- service --port=6379 --target-port=6379
  • 59. kubectl create deploy webapp -- image=kodekloud/webapp-color • create deploy不用加--name=
  • 60. kubectl run custom-nginx --image=nginx -- port=8080
  • 62. • create deploy不用加--name= • 不能使用--replics=N
  • 63. kubectl expose pod 必須同時有--target- port=80 --port=80

Editor's Notes

  • #5: https://www.youtube.com/watch?v=xuvpjZ6m35Q&list=PLmOn9nNkQxJFiWd13kMX4w5ebum1AFJpv&index=28
  • #9: 版本:2, 3 是獨立分開的(不互相支援)、預設是2
  • #19: https://ithelp.ithome.com.tw/articles/10194152
  • #22: https://tachingchen.com/tw/blog/kubernetes-rolling-update-with-deployment/