本文主要是介绍飞天使-k8s知识点27-kubernetes温故知新2-deployment,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
文章目录
- RC和RS
- 无状态应用管理 deployment
- 有状态应用statefulSet
- daemonSet
RC和RS
RC不会使用在生产环境
RS 比RC 多了标签选择器 ,RS 用deployment管理,用于容器编排
无状态应用管理 deployment
apiVersion: apps/v1
kind: Deployment
metadata:name: nginx-deploymentlabels:app: nginx
spec:replicas: 3selector:matchLabels:app: nginxtemplate:metadata:labels:app: nginxspec:containers:- name: nginximage: nginx:1.15.12ports:- containerPort: 80
deployment 涉及 更新,回滚,根据标签去控制pod,扩容,缩容
有状态应用statefulSet
apiVersion: v1
kind: Service
metadata:name: nginxlabels:app: nginx
spec:ports:- port: 80name: webclusterIP: Noneselector:app: nginx
---
apiVersion: apps/v1
kind: StatefulSet
metadata:name: web
spec:serviceName: "nginx"replicas: 2selector:matchLabels:app: nginxtemplate:metadata:labels:app: nginxspec:containers:- name: nginximage: nginxports:- containerPort: 80name: web
daemonSet
apiVersion: apps/v1
kind: DaemonSet
metadata:labels:app: nginxname: nginx
spec:selector:matchLabels:app: nginxtemplate:metadata:labels:app: nginxspec:containers:- image: nginx:1.15.12imagePullPolicy: IfNotPresentname: nginx
参考资料: 宽哥
这篇关于飞天使-k8s知识点27-kubernetes温故知新2-deployment的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!