[kubernetes]-OpenKruise原地升级statefulset
导语:今天了解了一下OpenKruise的特性。打算尝试一下测试环境:k8s版本1.18需要CustomResourceWebhookConversion这个特性。建议使用1.18及以上版本先安装helm3# 先下载安装包并解压安装。# 解压文件tar zxvf helm-v3.2.3-linux-amd64.tar.gzcd linux-amd64/cp -r helm/usr/local/bi
·
导语:今天了解了一下OpenKruise的特性。打算尝试一下
测试环境:k8s版本1.18
需要CustomResourceWebhookConversion这个特性。建议使用1.18及以上版本
先安装helm3
# 先下载安装包 并解压安装。
# 解压文件
tar zxvf helm-v3.2.3-linux-amd64.tar.gz
cd linux-amd64/
cp -r helm /usr/local/bin/
# 查看版本号
helm version
用helm安装OpenKruise
helm install kruise https://github.com/openkruise/kruise/releases/download/v0.7.0/kruise-chart.tgz --disable-openapi-validation
出现这个问题报错说是找不到集群 集群不可达
是因为helm没指定apiserver的原因,指定一下apiserver就好了。
# 我的是二进制部署的1.18
export KUBERNETES_MASTER=http://127.0.0.1:8080
创建yaml 这个是官方demo
apiVersion: apps.kruise.io/v1beta1
kind: StatefulSet
metadata:
name: sample
spec:
replicas: 3
serviceName: fake-service
selector:
matchLabels:
app: sample
template:
metadata:
labels:
app: sample
spec:
readinessGates:
# A new condition that ensures the pod remains at NotReady state while the in-place update is happening
- conditionType: InPlaceUpdateReady
containers:
- name: main
image: nginx:alpine
podManagementPolicy: Parallel # allow parallel updates, works together with maxUnavailable
updateStrategy:
type: RollingUpdate
rollingUpdate:
# Do in-place update if possible, currently only image update is supported for in-place update
podUpdatePolicy: InPlaceIfPossible
# Allow parallel updates with max number of unavailable instances equals to 2
maxUnavailable: 2
用了这个创建sts之后 kubectl get sts 是查不到statefulset的
更新镜像为1.18之后重新apply
更新过程 如下。个人感觉是飞快。方式是是重启。
查看ip 并更新为原来的镜像并观察ip是否变化
发现更新过程中ip并没有变化 restart 的数量增加了一次。并且更新顺序并不是2 到1 到0 而是 1到 2到 0,即可能是无序的。并且可以看到READINESS GATES这个参数。
官方文档
https://openkruise.io/en-us/docs/what_is_openkruise.html
更多推荐
已为社区贡献84条内容
所有评论(0)