第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

k8s使用openebs實現(xiàn)動態(tài)持久化存儲

標(biāo)簽:
Kubernetes

简介

本文章介绍如何使用openebs为k8s提供动态申请pv的功能。iscsi提供底层存储功能,openebs管理iscsi。目前只支持pv的ReadWriteOnce访问模式

访问模式只是能力描述,并不是强制执行的,对于没有按pvc声明的方式使用pv,存储提供者应该负责访问时的运行错误。例如如果设置pvc的访问模式为ReadOnlyMany ,pod挂载后依然可写,如果需要真正的不可写,申请pvc是需要指定 readOnly: true 参数

安装

实验用的Vagrantfile

# -*- mode: ruby -*-# vi: set ft=ruby :ENV["LC_ALL"] = "en_US.UTF-8"Vagrant.configure("2") do |config|
    (1..3).each do |i|
      config.vm.define "lab#{i}" do |node|
        node.vm.box = "centos-7.4-docker-17"
        node.ssh.insert_key = false
        node.vm.hostname = "lab#{i}"
        node.vm.network "private_network", ip: "11.11.11.11#{i}"
        node.vm.provision "shell",          inline: "echo hello from node #{i}"
        node.vm.provider "virtualbox" do |v|
          v.cpus = 2
          v.customize ["modifyvm", :id, "--name", "lab#{i}", "--memory", "3096"]
          file_to_disk = "lab#{i}_vdb.vdi"
          unless File.exist?(file_to_disk)            # 50GB
            v.customize ['createhd', '--filename', file_to_disk, '--size', 50 * 1024]          end
          v.customize ['storageattach', :id, '--storagectl', 'IDE', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', file_to_disk]        end
      end
    endend

安装配置iscsi

# 安装 iscsiyum install iscsi-initiator-utils -y# 查看 InitiatorName 是否正常配置cat /etc/iscsi/initiatorname.iscsi# 启动查看状态systemctl start iscsid.service
systemctl status iscsid.service

systemctl start iscsi.service
systemctl status iscsi.service

安装openebs

# 部署mkdir openebs && cd openebs
wget https://raw.githubusercontent.com/openebs/openebs/v0.6/k8s/openebs-operator.yaml
wget https://raw.githubusercontent.com/openebs/openebs/v0.6/k8s/openebs-storageclasses.yaml
kubectl apply -f openebs-operator.yaml
kubectl apply -f openebs-storageclasses.yaml# 查看 openebs 状态kubectl get pods -n openebs -o wide
kubectl get svc -n openebs
kubectl get crd

测试

# 查看 storage classkubectl get sc# 创建pvc测试cat >openebs-pvc-test.yaml<<EOF
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
 name: openebs1
spec:
 storageClassName: openebs-standard
 accessModes:
  - ReadWriteOnce
 resources:
   requests:
     storage: 5Gi
EOF
kubectl apply -f openebs-pvc-test.yaml 
# 查看kubectl get pvc
kubectl get pv 
# 创建 nginx pod 挂载测试cat >nginx-pod.yaml<<EOF
apiVersion: v1
kind: Pod
metadata:
  name: nginx-pod1
  labels:
    name: nginx-pod1
spec:
  containers:
  - name: nginx-pod1
    image: nginx:alpine
    ports:
    - name: web
      containerPort: 80
    volumeMounts:
    - name: openebs1-vol1
      mountPath: /usr/share/nginx/html
  volumes:
  - name: openebs1-vol1
    persistentVolumeClaim:
      claimName: openebs1
EOF
kubectl apply -f nginx-pod.yaml 
# 查看kubectl get pods -o wide 
# 修改文件内容kubectl exec -ti nginx-pod1 -- /bin/sh -c 'echo Hello World from Openebs!!! > /usr/share/nginx/html/index.html'
 # 访问测试POD_ID=$(kubectl get pods -o wide | grep nginx-pod1 | awk '{print $(NF-1)}')
curl http://$POD_ID



作者:CountingStars_
链接:https://www.jianshu.com/p/f0ac69afc418


點擊查看更多內(nèi)容
TA 點贊

若覺得本文不錯,就分享一下吧!

評論

作者其他優(yōu)質(zhì)文章

正在加載中
  • 推薦
  • 評論
  • 收藏
  • 共同學(xué)習(xí),寫下你的評論
感謝您的支持,我會繼續(xù)努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦
今天注冊有機會得

100積分直接送

付費專欄免費學(xué)

大額優(yōu)惠券免費領(lǐng)

立即參與 放棄機會
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號

舉報

0/150
提交
取消