root@ubuntu heketi % kubectl create -f glusterfs-daemonset.json error: unable to recognize "glusterfs-daemonset.json": no matches for kind "DaemonSet" in version "extensions/v1beta1"
修改 api 版本
1
"apiVersion": "extensions/v1beta1"
为 apps/v1
1
"apiVersion": "apps/v1",
报 selector 错
1 2
root@ubuntu heketi % kubectl create -f glusterfs-daemonset.json error: error validating "glusterfs-daemonset.json": error validating data: ValidationError(DaemonSet.spec): missing required field "selector" in io.k8s.api.apps.v1.DaemonSetSpec; if you choose to ignore these errors, turn validation off with --validate=false
[root@ubuntu heketi]# kubectl create -f glusterfs-daemonset.json error: error validating "glusterfs-daemonset.json": error validating data: ValidationError(DaemonSet.spec): missing required field "selector" in io.k8s.api.apps.v1.DaemonSetSpec; if you choose to ignore these errors, turn validation off with --validate=false
kubectl get pvc NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE gluster1 Bound pvc-4aa45417-e35f-4a44-8360-3aa2fd5990e0 1Gi RWO gluster-heketi 8m39s
kubectl exec -ti nginx-pod1 /bin/sh $ cd /usr/share/nginx/html $ echo 'Hello World from GlusterFS!!!' > index.html $ ls index.html $ curl http://10.38.0.0 Hello World from GlusterFS!!!
最后检查 glusterfs pod 中挂载文件是否一致
1 2 3 4 5 6 7 8 9 10
kubectl exec -ti glusterfs-5ccwd /bin/sh $ mount | grep heketi /dev/xvda1 on /var/lib/heketi type ext4 (rw,relatime,discard,data=ordered) /dev/mapper/vg_3e5321815938a95cba981bec1d81c4b0-brick_a3df6570e7a9d94739a4fe6d6491626d on /var/lib/heketi/mounts/vg_3e5321815938a95cba981bec1d81c4b0/brick_a3df6570e7a9d94739a4fe6d6491626d type xfs (rw,noatime,nouuid,attr2,inode64,logbsize=128k,sunit=256,swidth=512,noquota) /dev/mapper/vg_3e5321815938a95cba981bec1d81c4b0-brick_f13e4577ad6ac6e22ec68f65a70908e0 on /var/lib/heketi/mounts/vg_3e5321815938a95cba981bec1d81c4b0/brick_f13e4577ad6ac6e22ec68f65a70908e0 type xfs (rw,noatime,nouuid,attr2,inode64,logbsize=128k,sunit=256,swidth=512,noquota) cd /var/lib/heketi/mounts/vg_3e5321815938a95cba981bec1d81c4b0/brick_f13e4577ad6ac6e22ec68f65a70908e0/brick $ ls index.html $ cat index.html Hello World from GlusterFS!!!