kubernetes集群三步安裝
讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來自于我們對(duì)這個(gè)行業(yè)的熱愛。我們立志把好的技術(shù)通過有效、簡(jiǎn)單的方式提供給客戶,將通過不懈努力成為客戶在信息化領(lǐng)域值得信任、有價(jià)值的長(zhǎng)期合作伙伴,公司提供的服務(wù)項(xiàng)目有:主機(jī)域名、虛擬空間、營(yíng)銷軟件、網(wǎng)站建設(shè)、相山網(wǎng)站維護(hù)、網(wǎng)站推廣。
git clone https://github.com/rook/rook
cd cluster/examples/kubernetes/ceph
kubectl create -f operator.yaml
查看operator是否成功:
[root@dev-86-201 ~]# kubectl get pod -n rook-ceph-system
NAME READY STATUS RESTARTS AGE
rook-ceph-agent-5z6p7 1/1 Running 0 88m
rook-ceph-agent-6rj7l 1/1 Running 0 88m
rook-ceph-agent-8qfpj 1/1 Running 0 88m
rook-ceph-agent-xbhzh 1/1 Running 0 88m
rook-ceph-operator-67f4b8f67d-tsnf2 1/1 Running 0 88m
rook-discover-5wghx 1/1 Running 0 88m
rook-discover-lhwvf 1/1 Running 0 88m
rook-discover-nl5m2 1/1 Running 0 88m
rook-discover-qmbx7 1/1 Running 0 88m
然后創(chuàng)建ceph集群:
kubectl create -f cluster.yaml
查看ceph集群:
[root@dev-86-201 ~]# kubectl get pod -n rook-ceph
NAME READY STATUS RESTARTS AGE
rook-ceph-mgr-a-8649f78d9b-jklbv 1/1 Running 0 64m
rook-ceph-mon-a-5d7fcfb6ff-2wq9l 1/1 Running 0 81m
rook-ceph-mon-b-7cfcd567d8-lkqff 1/1 Running 0 80m
rook-ceph-mon-d-65cd79df44-66rgz 1/1 Running 0 79m
rook-ceph-osd-0-56bd7545bd-5k9xk 1/1 Running 0 63m
rook-ceph-osd-1-77f56cd549-7rm4l 1/1 Running 0 63m
rook-ceph-osd-2-6cf58ddb6f-wkwp6 1/1 Running 0 63m
rook-ceph-osd-3-6f8b78c647-8xjzv 1/1 Running 0 63m
參數(shù)說明:
apiVersion: ceph.rook.io/v1
kind: CephCluster
metadata:
name: rook-ceph
namespace: rook-ceph
spec:
cephVersion:
# For the latest ceph images, see https://hub.docker.com/r/ceph/ceph/tags
image: ceph/ceph:v13.2.2-20181023
dataDirHostPath: /var/lib/rook # 數(shù)據(jù)盤目錄
mon:
count: 3
allowMultiplePerNode: true
dashboard:
enabled: true
storage:
useAllNodes: true
useAllDevices: false
config:
databaseSizeMB: "1024"
journalSizeMB: "1024"
訪問ceph dashboard:
[root@dev-86-201 ~]# kubectl get svc -n rook-ceph
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
rook-ceph-mgr ClusterIP 10.98.183.33 <none> 9283/TCP 66m
rook-ceph-mgr-dashboard NodePort 10.103.84.48 <none> 8443:31631/TCP 66m # 把這個(gè)改成NodePort模式
rook-ceph-mon-a ClusterIP 10.99.71.227 <none> 6790/TCP 83m
rook-ceph-mon-b ClusterIP 10.110.245.119 <none> 6790/TCP 82m
rook-ceph-mon-d ClusterIP 10.101.79.159 <none> 6790/TCP 81m
然后訪問https://10.1.86.201:31631 即可
管理賬戶admin,獲取登錄密碼:
kubectl -n rook-ceph get secret rook-ceph-dashboard-password -o yaml | grep "password:" | awk '{print $2}' | base64 --decode
apiVersion: ceph.rook.io/v1
kind: CephBlockPool
metadata:
name: replicapool # operator會(huì)監(jiān)聽并創(chuàng)建一個(gè)pool,執(zhí)行完后界面上也能看到對(duì)應(yīng)的pool
namespace: rook-ceph
spec:
failureDomain: host
replicated:
size: 3
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: rook-ceph-block # 這里創(chuàng)建一個(gè)storage class, 在pvc中指定這個(gè)storage class即可實(shí)現(xiàn)動(dòng)態(tài)創(chuàng)建PV
provisioner: ceph.rook.io/block
parameters:
blockPool: replicapool
# The value of "clusterNamespace" MUST be the same as the one in which your rook cluster exist
clusterNamespace: rook-ceph
# Specify the filesystem type of the volume. If not specified, it will use `ext4`.
fstype: xfs
# Optional, default reclaimPolicy is "Delete". Other options are: "Retain", "Recycle" as documented in https://kubernetes.io/docs/concepts/storage/storage-classes/
reclaimPolicy: Retain
在cluster/examples/kubernetes 目錄下,官方給了個(gè)worldpress的例子,可以直接運(yùn)行一下:
kubectl create -f MySQL.yaml
kubectl create -f wordpress.yaml
查看PV PVC:
[root@dev-86-201 ~]# kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
mysql-pv-claim Bound pvc-a910f8c2-1ee9-11e9-84fc-becbfc415cde 20Gi RWO rook-ceph-block 144m
wp-pv-claim Bound pvc-af2dfbd4-1ee9-11e9-84fc-becbfc415cde 20Gi RWO rook-ceph-block 144m
[root@dev-86-201 ~]# kubectl get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
pvc-a910f8c2-1ee9-11e9-84fc-becbfc415cde 20Gi RWO Retain Bound default/mysql-pv-claim rook-ceph-block 145m
pvc-af2dfbd4-1ee9-11e9-84fc-becbfc415cde 20Gi RWO Retain Bound default/wp-pv-claim rook-ceph-block 145m
看下yaml文件:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql-pv-claim
labels:
app: wordpress
spec:
storageClassName: rook-ceph-block # 指定storage class
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi # 需要一個(gè)20G的盤
...
volumeMounts:
- name: mysql-persistent-storage
mountPath: /var/lib/mysql
volumes:
- name: mysql-persistent-storage
persistentVolumeClaim:
claimName: mysql-pv-claim # 指定上面定義的PVC
是不是非常簡(jiǎn)單。
要訪問wordpress的話請(qǐng)把service改成NodePort類型,官方給的是loadbalance類型:
kubectl edit svc wordpress
[root@dev-86-201 kubernetes]# kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
wordpress NodePort 10.109.30.99 <none> 80:30130/TCP 148m
分布式存儲(chǔ)在容器集群中充當(dāng)非常重要的角色,使用容器集群一個(gè)非常重要的理念就是把集群當(dāng)成一個(gè)整體使用,如果你在使用中還關(guān)心單個(gè)主機(jī),比如調(diào)度到某個(gè)節(jié)點(diǎn),
掛載某個(gè)節(jié)點(diǎn)目錄等,必然會(huì)導(dǎo)致不能把云的威力百分之百發(fā)揮出來。 一旦計(jì)算存儲(chǔ)分離后,就可真正實(shí)現(xiàn)隨意漂移,對(duì)集群維護(hù)來說是個(gè)極大的福音。
比如集群機(jī)器過保了需要下架,那么我們?cè)苹募軜?gòu)因?yàn)樗袞|西無單點(diǎn),所以只需要簡(jiǎn)單驅(qū)逐改節(jié)點(diǎn),然后下架即可,不用關(guān)心上面跑的是什么業(yè)務(wù),不管是有狀態(tài)還是無
狀態(tài)的都可以自動(dòng)修復(fù)。 不過目前面臨最大的挑戰(zhàn)可能還是分布式存儲(chǔ)的性能問題。 在性能要求不苛刻的場(chǎng)景下我是極推薦這種計(jì)算存儲(chǔ)分離架構(gòu)的。
分享題目:rook使用教程,快速編排ceph
網(wǎng)站鏈接:http://jinyejixie.com/article20/ipipjo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供自適應(yīng)網(wǎng)站、品牌網(wǎng)站設(shè)計(jì)、用戶體驗(yàn)、網(wǎng)站營(yíng)銷、企業(yè)建站、App設(shè)計(jì)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)