對服務(wù)器程序來說,究竟是有狀態(tài)服務(wù),還是無狀態(tài)服務(wù),其判斷依舊是指兩個(gè)來自相同發(fā)起者的請求在服務(wù)器端是否具備上下文關(guān)系。如果是狀態(tài)化請求,那么服務(wù)器端一般都要保存請求的相關(guān)信息,每個(gè)請求可以默認(rèn)地使用以前的請求信息。而對于無狀態(tài)請求,服務(wù)器端所能夠處理的過程必須全部來自于請求所攜帶的信息,以及其他服務(wù)器端自身所保存的、并且可以被所有請求所使用的公共信息。
無狀態(tài)的服務(wù)器程序,最著名的就是WEB服務(wù)器。每次HTTP請求和以前都沒有什么關(guān)系,只是獲取目標(biāo)URI。得到目標(biāo)內(nèi)容之后,這次連接就被殺死,沒有任何痕跡。在后來的發(fā)展進(jìn)程中,逐漸在無狀態(tài)化的過程中,加入狀態(tài)化的信息,比如COOKIE。服務(wù)端在響應(yīng)客戶端的請求的時(shí)候,會向客戶端推送一個(gè)COOKIE,這個(gè)COOKIE記錄服務(wù)端上面的一些信息??蛻舳嗽诤罄m(xù)的請求中,可以攜帶這個(gè)COOKIE,服務(wù)端可以根據(jù)這個(gè)COOKIE判斷這個(gè)請求的上下文關(guān)系。COOKIE的存在,是無狀態(tài)化向狀態(tài)化的一個(gè)過渡手段,他通過外部擴(kuò)展手段,COOKIE來維護(hù)上下文關(guān)系。
狀態(tài)化的服務(wù)器有更廣闊的應(yīng)用范圍,比如MSN、網(wǎng)絡(luò)游戲等服務(wù)器。他在服務(wù)端維護(hù)每個(gè)連接的狀態(tài)信息,服務(wù)端在接收到每個(gè)連接的發(fā)送的請求時(shí),可以從本地存儲的信息來重現(xiàn)上下文關(guān)系。這樣,客戶端可以很容易使用缺省的信息,服務(wù)端也可以很容易地進(jìn)行狀態(tài)管理。比如說,當(dāng)一個(gè)用戶登錄后,服務(wù)端可以根據(jù)用戶名獲取他的生日等先前的注冊信息;而且在后續(xù)的處理中,服務(wù)端也很容易找到這個(gè)用戶的歷史信息。
狀態(tài)化服務(wù)器在功能實(shí)現(xiàn)方面具有更加強(qiáng)大的優(yōu)勢,但由于他需要維護(hù)大量的信息和狀態(tài),在性能方面要稍遜于無狀態(tài)服務(wù)器。無狀態(tài)服務(wù)器在處理簡單服務(wù)方面有優(yōu)勢,但復(fù)雜功能方面有很多弊端,比如,用無狀態(tài)服務(wù)器來實(shí)現(xiàn)即時(shí)通訊服務(wù)器,將會是場惡夢。
在k8s中,對web這種無狀態(tài)服務(wù)實(shí)現(xiàn)數(shù)據(jù)持久化時(shí),采用我之前的博文:K8s數(shù)據(jù)持久化之自動創(chuàng)建PV的方式對其實(shí)現(xiàn)即可。但是如果對數(shù)據(jù)庫這種有狀態(tài)的服務(wù)使用這種數(shù)據(jù)持久化方式的話,那么將會有一個(gè)很嚴(yán)重的問題,就是當(dāng)對數(shù)據(jù)庫進(jìn)行寫入操作時(shí),你會發(fā)現(xiàn)只能對后端的多個(gè)容器中的其中一個(gè)容器進(jìn)行寫入,當(dāng)然,nfs目錄下也會有數(shù)據(jù)庫寫入的數(shù)據(jù),但是,其無法被其他數(shù)據(jù)庫讀取到,因?yàn)樵跀?shù)據(jù)庫中有很多影響因素,比如server_id,數(shù)據(jù)庫分區(qū)表信息等。
當(dāng)然,除了數(shù)據(jù)庫之外,還有其他的有狀態(tài)服務(wù)不可以使用上述的數(shù)據(jù)持久化方式。
StatefulSet也是一種資源對象(在kubelet 1.5版本之前都叫做PetSet),這種資源對象和RS、RC、Deployment一樣,都是Pod控制器。
在Kubernetes中,大多數(shù)的Pod管理都是基于無狀態(tài)、一次性的理念。例如Replication Controller,它只是簡單的保證可提供服務(wù)的Pod數(shù)量。如果一個(gè)Pod被認(rèn)定為不健康的,Kubernetes就會以對待牲畜的態(tài)度對待這個(gè)Pod——?jiǎng)h掉、重建。相比于牲畜應(yīng)用,PetSet(寵物應(yīng)用),是由一組有狀態(tài)的Pod組成,每個(gè)Pod有自己特殊且不可改變的ID,且每個(gè)Pod中都有自己獨(dú)一無二、不能刪除的數(shù)據(jù)。
眾所周知,相比于無狀態(tài)應(yīng)用的管理,有狀態(tài)應(yīng)用的管理是非常困難的。有狀態(tài)的應(yīng)用需要固定的ID、有自己內(nèi)部可不見的通信邏輯、特別容器出現(xiàn)劇烈波動等。傳統(tǒng)意義上,對有狀態(tài)應(yīng)用的管理一般思路都是:固定機(jī)器、靜態(tài)IP、持久化存儲等。Kubernetes利用PetSet這個(gè)資源,弱化有狀態(tài)Pet與具體物理設(shè)施之間的關(guān)聯(lián)。一個(gè)PetSet能夠保證在任意時(shí)刻,都有固定數(shù)量的Pet在運(yùn)行,且每個(gè)Pet都有自己唯一的身份。
一個(gè)“有身份”的Pet指的是該P(yáng)et中的Pod包含如下特性:
- 靜態(tài)存儲;
- 有固定的主機(jī)名,且DNS可尋址(穩(wěn)定的網(wǎng)絡(luò)身份,這是通過一種叫 Headless Service 的特殊Service來實(shí)現(xiàn)的。 和普通Service相比,Headless Service沒有Cluster IP,用于為一個(gè)集群內(nèi)部的每個(gè)成員提供一個(gè)唯一的DNS名字,用于集群內(nèi)部成員之間通信 。);
- 一個(gè)有序的index(比如PetSet的名字叫mysql,那么第一個(gè)啟起來的Pet就叫mysql-0,第二個(gè)叫mysql-1,如此下去。當(dāng)一個(gè)Pet down掉后,新創(chuàng)建的Pet會被賦予跟原來Pet一樣的名字,通過這個(gè)名字就能匹配到原來的存儲,實(shí)現(xiàn)狀態(tài)保存。)
1、應(yīng)用舉例:
- 數(shù)據(jù)庫應(yīng)用,如Mysql、PostgreSQL,需要一個(gè)固定的ID(用于數(shù)據(jù)同步)以及外掛一塊NFS Volume(持久化存儲)。
- 集群軟件,如zookeeper、Etcd,需要固定的成員關(guān)系。
2、使用限制- 1.4新加功能,1.3及之前版本不可用;
- DNS,要求使用1.4或1.4之后的DNS插件,1.4之前的插件只能解析Service對應(yīng)的IP,無法解析Pod(HostName)對應(yīng)的域名;
- 需要持久化數(shù)據(jù)卷(PV,若為nfs這種無法通過調(diào)用API來創(chuàng)建存儲的網(wǎng)絡(luò)存儲,數(shù)據(jù)卷要在創(chuàng)建PetSet之前靜態(tài)創(chuàng)建;若為aws-ebs、vSphere、openstack Cinder這種可以通過API調(diào)用來動態(tài)創(chuàng)建存儲的虛擬存儲,數(shù)據(jù)卷除了可以通過靜態(tài)的方式創(chuàng)建以外,還可以通過StorageClass進(jìn)行動態(tài)創(chuàng)建。需要注意的是,動態(tài)創(chuàng)建出來的PV,默認(rèn)的回收策略是delete,及在刪除數(shù)據(jù)的同時(shí),還會把虛擬存儲卷刪除);
- 刪除或縮容PetSet不會刪除對應(yīng)的持久化數(shù)據(jù)卷,這么做是出于數(shù)據(jù)安全性的考慮;
- 只能通過手動的方式升級PetSet。
這種方式,與K8s數(shù)據(jù)持久化之自動創(chuàng)建PV的方式有很多相同點(diǎn),都需要底層NFS存儲、rbac授權(quán)賬戶,nfs-client-Provisioner提供存儲,SC存儲類這些東西,唯一不同的是,這種針對于有狀態(tài)服務(wù)的數(shù)據(jù)持久化,并不需要我們手動創(chuàng)建PV。
搭建registry私有倉庫:
[root@master ~]# docker run -tid --name registry -p 5000:5000 -v /data/registry:/var/lib/registry --restart always registry
[root@master ~]# vim /usr/lib/systemd/system/docker.service #更改docker的配置文件,以便指定私有倉庫
ExecStart=/usr/bin/dockerd -H unix:// --insecure-registry 192.168.20.6:5000
[root@master ~]# scp /usr/lib/systemd/system/docker.service node01:/usr/lib/systemd/system/
[root@master ~]# scp /usr/lib/systemd/system/docker.service node02:/usr/lib/systemd/system/
[root@master ~]# systemctl daemon-reload
[root@master ~]# systemctl restart docker
搭建NFS服務(wù):
[root@master ~]# yum -y install nfs-utils
[root@master ~]# systemctl enable rpcbind
[root@master ~]# vim /etc/exports
/nfsdata *(rw,sync,no_root_squash)
[root@master ~]# systemctl start rpcbind
[root@master ~]# systemctl start nfs
[root@master ~]# showmount -e
Export list for master:
/nfsdata *
以上皆屬于準(zhǔn)備工作。
1、使用自定義鏡像,創(chuàng)建StatefulSet資源對象,要求每個(gè)都做數(shù)據(jù)持久化。副本數(shù)量為6個(gè)。數(shù)據(jù)持久化目錄為:/usr/local/apache2/htdocs
創(chuàng)建rbac授權(quán)
[root@master ljz]# vim rbac.yaml #編寫yaml文件
apiVersion: v1
kind: ServiceAccount
metadata:
name: nfs-provisioner
namespace: default
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: nfs-provisioner-runner
namespace: default
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["events"]
verbs: ["watch", "create", "update", "patch"]
- apiGroups: [""]
resources: ["services", "endpoints"]
verbs: ["get","create","list", "watch","update"]
- apiGroups: ["extensions"]
resources: ["podsecuritypolicies"]
resourceNames: ["nfs-provisioner"]
verbs: ["use"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: run-nfs-provisioner
subjects:
- kind: ServiceAccount
name: nfs-provisioner
namespace: default
roleRef:
kind: ClusterRole
name: nfs-provisioner-runner
apiGroup: rbac.authorization.k8s.io
[root@master ljz]# kubectl apply -f rbac.yaml #執(zhí)行yaml文件
創(chuàng)建NFS-clinet-Provisioner
[root@master ljz]# vim nfs-deploymnet.yaml #編寫yaml文件
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nfs-client-provisioner
namespace: default
spec:
replicas: 1
strategy:
type: Recreate
template:
metadata:
labels:
app: nfs-client-provisioner
spec:
serviceAccount: nfs-provisioner
containers:
- name: nfs-client-provisioner
image: registry.cn-hangzhou.aliyuncs.com/open-ali/nfs-client-provisioner
volumeMounts:
- name: nfs-client-root
mountPath: /persistentvolumes
env:
- name: PROVISIONER_NAME
value: ljz
- name: NFS_SERVER
value: 192.168.20.6
- name: NFS_PATH
value: /nfsdata
volumes:
- name: nfs-client-root
nfs:
server: 192.168.20.6
path: /nfsdata
[root@master ljz]# kubectl apply -f nfs-deploymnet.yaml #執(zhí)行yaml文件
創(chuàng)建SC(storageClass)
[root@master ljz]# vim sc.yaml #編寫yaml文件
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: test-sc
provisioner: ljz
reclaimPolicy: Retain
[root@master ljz]# kubectl apply -f sc.yaml #執(zhí)行yaml文件
創(chuàng)建POd
[root@master ljz]# vim statefulset.yaml #編寫yaml文件
apiVersion: v1
kind: Service
metadata:
name: headless-svc
labels:
app: headless-svc
spec:
ports:
- name: testweb
port: 80
selector:
app: headless-pod
clusterIP: None
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: statefulset
spec:
serviceName: headless-svc
replicas: 6
selector:
matchLabels:
app: headless-pod
template:
metadata:
labels:
app: headless-pod
spec:
containers:
- name: testhttpd
image: 192.168.20.6:5000/ljz:v1
ports:
- containerPort: 80
volumeMounts:
- name: test
mountPath: /usr/local/apache2/htdocs
volumeClaimTemplates:
- metadata:
name: test
annotations:
volume.beta.kubernetes.io/storage-class: test-sc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
[root@master ljz]# kubectl apply -f statefulset.yaml
[root@master ljz]# kubectl get pod -w
NAME READY STATUS RESTARTS AGE
nfs-client-provisioner-6649749f97-cl92m 1/1 Running 0 7m57s
statefulset-0 1/1 Running 0 26s
statefulset-1 1/1 Running 0 24s
statefulset-2 1/1 Running 0 20s
statefulset-3 1/1 Running 0 16s
statefulset-4 1/1 Running 0 13s
statefulset-5 1/1 Running 0 9s
[root@master ljz]# kubectl get pv,pvc
2、完成之后,要求第0--5個(gè)Pod的主目錄應(yīng)該為: Version:--v1
將服務(wù)進(jìn)行擴(kuò)容:副本數(shù)量更新為10個(gè),驗(yàn)證是否會繼續(xù)為新的Pod創(chuàng)建持久化的PV,PVC
[root@master ljz]# vim a.sh #編寫腳本定義首頁
#!/bin/bash
for i in `ls /nfsdata`
do
echo "Version: --v1" > /nfsdata/${i}/index.html
done
[root@master ljz]# kubectl get pod -o wide #查看節(jié)點(diǎn)IP,隨機(jī)驗(yàn)證首頁文件
[root@master ljz]# curl 10.244.1.3
Version: --v1
[root@master ljz]# curl 10.244.1.5
Version: --v1
[root@master ljz]# curl 10.244.2.4
Version: --v1
#進(jìn)行擴(kuò)容更新
[root@master ljz]# vim statefulset.yaml
apiVersion: v1
kind: Service
metadata:
name: headless-svc
labels:
app: headless-svc
spec:
ports:
- name: testweb
port: 80
selector:
app: headless-pod
clusterIP: None
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: statefulset
spec:
updateStrategy:
rollingUpdate:
partition: 4
serviceName: headless-svc
replicas: 10
selector:
matchLabels:
app: headless-pod
template:
metadata:
labels:
app: headless-pod
spec:
containers:
- name: testhttpd
image: 192.168.20.6:5000/ljz:v2
ports:
- containerPort: 80
volumeMounts:
- name: test
mountPath: /usr/local/apache2/htdocs
volumeClaimTemplates:
- metadata:
name: test
annotations:
volume.beta.kubernetes.io/storage-class: test-sc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
[root@master ljz]# kubectl get pod -w #查看其更新過程
NAME READY STATUS RESTARTS AGE
nfs-client-provisioner-6649749f97-cl92m 1/1 Running 0 40m
statefulset-0 1/1 Running 0 33m
statefulset-1 1/1 Running 0 33m
statefulset-2 1/1 Running 0 33m
statefulset-3 1/1 Running 0 33m
statefulset-4 1/1 Running 0 33m
statefulset-5 1/1 Running 0 33m
statefulset-6 0/1 ImagePullBackOff 0 5m9s
statefulset-6 1/1 Running 0 5m41s
statefulset-7 0/1 Pending 0 0s
statefulset-7 0/1 Pending 0 0s
statefulset-7 0/1 Pending 0 2s
statefulset-7 0/1 ContainerCreating 0 2s
statefulset-7 1/1 Running 0 4s
statefulset-8 0/1 Pending 0 0s
statefulset-8 0/1 Pending 0 0s
statefulset-8 0/1 Pending 0 1s
statefulset-8 0/1 ContainerCreating 0 1s
statefulset-8 1/1 Running 0 3s
statefulset-9 0/1 Pending 0 0s
statefulset-9 0/1 Pending 0 0s
statefulset-9 0/1 Pending 0 1s
statefulset-9 0/1 ContainerCreating 0 1s
statefulset-9 1/1 Running 0 3s
statefulset-5 1/1 Terminating 0 33m
statefulset-5 0/1 Terminating 0 33m
statefulset-5 0/1 Terminating 0 33m
statefulset-5 0/1 Terminating 0 33m
statefulset-5 0/1 Pending 0 0s
statefulset-5 0/1 Pending 0 0s
statefulset-5 0/1 ContainerCreating 0 0s
statefulset-5 1/1 Running 0 1s
statefulset-4 1/1 Terminating 0 33m
statefulset-4 0/1 Terminating 0 34m
statefulset-4 0/1 Terminating 0 34m
statefulset-4 0/1 Terminating 0 34m
statefulset-4 0/1 Pending 0 0s
statefulset-4 0/1 Pending 0 0s
statefulset-4 0/1 ContainerCreating 0 0s
statefulset-4 1/1 Running 0 1s
[root@master ljz]# kubectl get pv,pvc #查看其為擴(kuò)容后的容器創(chuàng)建的pv及pvc
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
persistentvolume/pvc-161fc655-7601-4996-99c8-a13cabaa4ad1 100Mi RWO Delete Bound default/test-statefulset-0 test-sc 38m
persistentvolume/pvc-1d1b0cfd-83cc-4cd6-a380-f23b9eac0411 100Mi RWO Delete Bound default/test-statefulset-4 test-sc 37m
persistentvolume/pvc-297495a8-2117-4232-8e9a-61019c03f0d0 100Mi RWO Delete Bound default/test-statefulset-7 test-sc 3m41s
persistentvolume/pvc-2e48a292-cb30-488e-90a9-5184811b9eb8 100Mi RWO Delete Bound default/test-statefulset-5 test-sc 37m
persistentvolume/pvc-407e2c0e-209d-4b5a-a3fa-454787f617a7 100Mi RWO Delete Bound default/test-statefulset-2 test-sc 37m
persistentvolume/pvc-56ac09a0-e51d-42a9-843b-f0a3a0c60a08 100Mi RWO Delete Bound default/test-statefulset-9 test-sc 3m34s
persistentvolume/pvc-90a05d1b-f555-44df-9bb3-73284001dda3 100Mi RWO Delete Bound default/test-statefulset-3 test-sc 37m
persistentvolume/pvc-9e2fd35e-5151-4790-b248-6545815d8c06 100Mi RWO Delete Bound default/test-statefulset-8 test-sc 3m37s
persistentvolume/pvc-9f60aab0-4491-4422-9514-1a945151909d 100Mi RWO Delete Bound default/test-statefulset-6 test-sc 9m22s
persistentvolume/pvc-ab64f8b8-737e-49a5-ae5d-e3b33188ce39 100Mi RWO Delete Bound default/test-statefulset-1 test-sc 37m
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
persistentvolumeclaim/test-statefulset-0 Bound pvc-161fc655-7601-4996-99c8-a13cabaa4ad1 100Mi RWO test-sc 38m
persistentvolumeclaim/test-statefulset-1 Bound pvc-ab64f8b8-737e-49a5-ae5d-e3b33188ce39 100Mi RWO test-sc 37m
persistentvolumeclaim/test-statefulset-2 Bound pvc-407e2c0e-209d-4b5a-a3fa-454787f617a7 100Mi RWO test-sc 37m
persistentvolumeclaim/test-statefulset-3 Bound pvc-90a05d1b-f555-44df-9bb3-73284001dda3 100Mi RWO test-sc 37m
persistentvolumeclaim/test-statefulset-4 Bound pvc-1d1b0cfd-83cc-4cd6-a380-f23b9eac0411 100Mi RWO test-sc 37m
persistentvolumeclaim/test-statefulset-5 Bound pvc-2e48a292-cb30-488e-90a9-5184811b9eb8 100Mi RWO test-sc 37m
persistentvolumeclaim/test-statefulset-6 Bound pvc-9f60aab0-4491-4422-9514-1a945151909d 100Mi RWO test-sc 9m22s
persistentvolumeclaim/test-statefulset-7 Bound pvc-297495a8-2117-4232-8e9a-61019c03f0d0 100Mi RWO test-sc 3m41s
persistentvolumeclaim/test-statefulset-8 Bound pvc-9e2fd35e-5151-4790-b248-6545815d8c06 100Mi RWO test-sc 3m37s
persistentvolumeclaim/test-statefulset-9 Bound pvc-56ac09a0-e51d-42a9-843b-f0a3a0c60a08 100Mi RWO test-sc 3m34s
[root@master nfsdata]# kubectl get pod -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
nfs-client-provisioner-6649749f97-cl92m 1/1 Running 0 54m 10.244.1.2 node01 <none> <none>
statefulset-0 1/1 Running 0 47m 10.244.1.3 node01 <none> <none>
statefulset-1 1/1 Running 0 47m 10.244.2.3 node02 <none> <none>
statefulset-2 1/1 Running 0 47m 10.244.2.4 node02 <none> <none>
statefulset-3 1/1 Running 0 47m 10.244.1.4 node01 <none> <none>
statefulset-4 1/1 Running 0 12m 10.244.2.8 node02 <none> <none>
statefulset-5 1/1 Running 0 13m 10.244.1.8 node01 <none> <none>
statefulset-6 1/1 Running 0 18m 10.244.2.6 node02 <none> <none>
statefulset-7 1/1 Running 0 13m 10.244.1.6 node01 <none> <none>
statefulset-8 1/1 Running 0 13m 10.244.2.7 node02 <none> <none>
statefulset-9 1/1 Running 0 13m 10.244.1.7 node01 <none> <none>
#查看其首頁文件
[root@master nfsdata]# curl 10.244.2.6
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<title>Index of /</title>
</head>
<body>
<h2>Index of /</h2>
<ul></ul>
</body></html>
[root@master nfsdata]# curl 10.244.1.8
Version: --v1
服務(wù)進(jìn)行更新:在更新過程中,要求3以后的全部更新為Version:v2
[root@master ljz]# vim a.sh #編寫首頁文件
#!/bin/bash
for i in `ls /nfsdata/`
do
if [ `echo $i | awk -F - '{print $4}'` -gt 3 ]
then
echo "Version: --v2" > /nfsdata/${i}/index.html
fi
done
[root@master ljz]# sh a.sh #執(zhí)行腳本
[root@master ljz]# kubectl get pod -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
nfs-client-provisioner-6649749f97-cl92m 1/1 Running 0 68m 10.244.1.2 node01 <none> <none>
statefulset-0 1/1 Running 0 60m 10.244.1.3 node01 <none> <none>
statefulset-1 1/1 Running 0 60m 10.244.2.3 node02 <none> <none>
statefulset-2 1/1 Running 0 60m 10.244.2.4 node02 <none> <none>
statefulset-3 1/1 Running 0 60m 10.244.1.4 node01 <none> <none>
statefulset-4 1/1 Running 0 26m 10.244.2.8 node02 <none> <none>
statefulset-5 1/1 Running 0 26m 10.244.1.8 node01 <none> <none>
statefulset-6 1/1 Running 0 32m 10.244.2.6 node02 <none> <none>
statefulset-7 1/1 Running 0 26m 10.244.1.6 node01 <none> <none>
statefulset-8 1/1 Running 0 26m 10.244.2.7 node02 <none> <none>
statefulset-9 1/1 Running 0 26m 10.244.1.7 node01 <none> <none>
#確認(rèn)內(nèi)容
[root@master ljz]# curl 10.244.1.4
Version: --v1
[root@master ljz]# curl 10.244.2.8
Version: --v2
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。
網(wǎng)頁題目:k8s之針對有狀態(tài)服務(wù)實(shí)現(xiàn)數(shù)據(jù)持久化-創(chuàng)新互聯(lián)
網(wǎng)頁路徑:http://www.rwnh.cn/article40/ceihho.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站制作、網(wǎng)站改版、外貿(mào)網(wǎng)站建設(shè)、定制網(wǎng)站、微信公眾號、服務(wù)器托管
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容