官术网_书友最值得收藏!

Deployments

One thing you may be thinking you will be able to do with a ReplicaSet is rolling upgrades and rollbacks. Unfortunately, ReplicaSets can only replicate the same version of a pod; luckily, this is where deployments come in.

A deployment controller is designed to update a ReplicaSet or pod. Lets use NGINX as an example. As you can see from the following definition, we have 3 replicas all running NGINX version 1.9.14:

apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 3
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.9.14
ports:
- containerPort: 80

kubectl is the command-line client for Kubernetes; we will be looking at this in more detail in our next chapter.

We could deploy this using the following command:

$ kubectl create -f nginx-deployment.yaml

Now say we want to update the version of the NGINX image used. We simply need to run the following command:

$ kubectl set image deployment/nginx-deployment nginx=nginx:1.13.5 deployment "nginx-deployment" image updated

This will update each pod in turn until all of the pods are running the new version of NGINX.

主站蜘蛛池模板: 潞西市| 青川县| 安西县| 阿坝县| 金山区| 金川县| 万山特区| 安庆市| 林周县| 朔州市| 武城县| 当雄县| 吉木乃县| 兰西县| 景泰县| 瑞昌市| 福贡县| 武山县| 钟山县| 惠水县| 双峰县| 安丘市| 光泽县| 安吉县| 宁安市| 深泽县| 华亭县| 常宁市| 右玉县| 通榆县| 高密市| 南陵县| 平湖市| 锡林郭勒盟| 东方市| 漳州市| 江都市| 佛坪县| 太仓市| 安康市| 阿荣旗|