本文已發布超過一年。較舊的文章可能包含過時的內容。請檢查頁面中的資訊自發布以來是否已變得不正確。
使用 Kubeadm 部署外部 OpenStack 雲端供應商
本文件說明如何在 CentOS 上使用 kubeadm 安裝單一控制平面的 Kubernetes 叢集 v1.15,然後部署外部 OpenStack 雲端供應商和 Cinder CSI 外掛程式,以在 Kubernetes 中使用 Cinder 磁碟區作為持久性磁碟區。
OpenStack 中的準備工作
此叢集在 OpenStack VM 上執行,因此我們先在 OpenStack 中建立一些項目。
- 此 Kubernetes 叢集的專案/租戶
- 此專案中 Kubernetes 的使用者,用於查詢節點資訊和掛載磁碟區等
- 私有網路和子網路
- 此私有網路的路由器,並將其連接到公用網路以取得浮動 IP
- 所有 Kubernetes VM 的安全群組
- 一個 VM 作為控制平面節點,以及一些 VM 作為工作節點
安全群組將具有以下規則,以開啟 Kubernetes 的連接埠。
控制平面節點
通訊協定 | 連接埠號碼 | 描述 |
---|---|---|
TCP | 6443 | Kubernetes API 伺服器 |
TCP | 2379-2380 | etcd 伺服器用戶端 API |
TCP | 10250 | Kubelet API |
TCP | 10251 | kube-scheduler |
TCP | 10252 | kube-controller-manager |
TCP | 10255 | 唯讀 Kubelet API |
工作節點
通訊協定 | 連接埠號碼 | 描述 |
---|---|---|
TCP | 10250 | Kubelet API |
TCP | 10255 | 唯讀 Kubelet API |
TCP | 30000-32767 | NodePort 服務 |
控制平面和工作節點上的 CNI 連接埠
通訊協定 | 連接埠號碼 | 描述 |
---|---|---|
TCP | 179 | Calico BGP 網路 |
TCP | 9099 | Calico felix (健康檢查) |
UDP | 8285 | Flannel |
UDP | 8472 | Flannel |
TCP | 6781-6784 | Weave Net |
UDP | 6783-6784 | Weave Net |
只有在使用特定的 CNI 外掛程式時,才需要開啟 CNI 特定連接埠。在本指南中,我們將使用 Weave Net。只需要在安全群組中開啟 Weave Net 連接埠 (TCP 6781-6784 和 UDP 6783-6784)。
控制平面節點至少需要 2 個核心和 4GB RAM。啟動 VM 後,請驗證其主機名稱,並確保其與 Nova 中的節點名稱相同。如果主機名稱無法解析,請將其新增至 /etc/hosts
。
例如,如果 VM 名稱為 master1,且其內部 IP 為 192.168.1.4。將其新增至 /etc/hosts
並將主機名稱設定為 master1。
echo "192.168.1.4 master1" >> /etc/hosts
hostnamectl set-hostname master1
安裝 Docker 和 Kubernetes
接下來,我們將按照官方文件使用 kubeadm 安裝 Docker 和 Kubernetes。
依照容器執行階段文件中的步驟安裝 Docker。
請注意,最佳實務是使用 systemd 作為 Kubernetes 的 cgroup 驅動程式。如果您使用內部容器登錄檔,請將其新增至 Docker 設定。
# Install Docker CE
## Set up the repository
### Install required packages.
yum install yum-utils device-mapper-persistent-data lvm2
### Add Docker repository.
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
## Install Docker CE.
yum update && yum install docker-ce-18.06.2.ce
## Create /etc/docker directory.
mkdir /etc/docker
# Configure the Docker daemon
cat > /etc/docker/daemon.json <<EOF
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2",
"storage-opts": [
"overlay2.override_kernel_check=true"
]
}
EOF
mkdir -p /etc/systemd/system/docker.service.d
# Restart Docker
systemctl daemon-reload
systemctl restart docker
systemctl enable docker
依照安裝 Kubeadm文件中的步驟安裝 kubeadm。
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF
# Set SELinux in permissive mode (effectively disabling it)
# Caveat: In a production environment you may not want to disable SELinux, please refer to Kubernetes documents about SELinux
setenforce 0
sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
systemctl enable --now kubelet
cat <<EOF > /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system
# check if br_netfilter module is loaded
lsmod | grep br_netfilter
# if not, load it explicitly with
modprobe br_netfilter
關於如何建立單一控制平面叢集的官方文件,請參閱使用 kubeadm 建立單一控制平面叢集文件。
我們將大致遵循該文件,但也為雲端供應商新增額外的項目。為了更清楚起見,我們將為控制平面節點使用 kubeadm-config.yml
。在此設定中,我們指定使用外部 OpenStack 雲端供應商,以及在哪裡找到其設定。我們也在 API 伺服器的執行階段設定中啟用儲存 API,以便我們可以在 Kubernetes 中使用 OpenStack 磁碟區作為持久性磁碟區。
apiVersion: kubeadm.k8s.io/v1beta1
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
cloud-provider: "external"
---
apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration
kubernetesVersion: "v1.15.1"
apiServer:
extraArgs:
enable-admission-plugins: NodeRestriction
runtime-config: "storage.k8s.io/v1=true"
controllerManager:
extraArgs:
external-cloud-volume-plugin: openstack
extraVolumes:
- name: "cloud-config"
hostPath: "/etc/kubernetes/cloud-config"
mountPath: "/etc/kubernetes/cloud-config"
readOnly: true
pathType: File
networking:
serviceSubnet: "10.96.0.0/12"
podSubnet: "10.224.0.0/16"
dnsDomain: "cluster.local"
現在我們將為 OpenStack 建立雲端設定 /etc/kubernetes/cloud-config
。請注意,此處的租戶是我們一開始為所有 Kubernetes VM 建立的租戶。所有 VM 都應在此專案/租戶中啟動。此外,您需要在該租戶中為 Kubernetes 建立使用者以執行查詢。ca-file 是 OpenStack API 端點的 CA 根憑證,例如 https://openstack.cloud:5000/v3
。在撰寫本文時,雲端供應商不允許不安全的連線 (略過 CA 檢查)。
[Global]
region=RegionOne
username=username
password=password
auth-url=https://openstack.cloud:5000/v3
tenant-id=14ba698c0aec4fd6b7dc8c310f664009
domain-id=default
ca-file=/etc/kubernetes/ca.pem
[LoadBalancer]
subnet-id=b4a9a292-ea48-4125-9fb2-8be2628cb7a1
floating-network-id=bc8a590a-5d65-4525-98f3-f7ef29c727d5
[BlockStorage]
bs-version=v2
[Networking]
public-network-name=public
ipv6-support-disabled=false
接下來執行 kubeadm 以初始化控制平面節點
kubeadm init --config=kubeadm-config.yml
初始化完成後,將管理員設定複製到 .kube
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
在此階段,已建立控制平面節點,但尚未就緒。所有節點都具有污點 node.cloudprovider.kubernetes.io/uninitialized=true:NoSchedule
,並等待 cloud-controller-manager 初始化。
# kubectl describe no master1
Name: master1
Roles: master
......
Taints: node-role.kubernetes.io/master:NoSchedule
node.cloudprovider.kubernetes.io/uninitialized=true:NoSchedule
node.kubernetes.io/not-ready:NoSchedule
......
現在將 OpenStack 雲端控制器管理員部署到叢集中,請依照搭配 kubeadm 使用控制器管理員。
使用 OpenStack 雲端供應商的雲端設定建立密鑰。
kubectl create secret -n kube-system generic cloud-config --from-literal=cloud.conf="$(cat /etc/kubernetes/cloud-config)" --dry-run -o yaml > cloud-config-secret.yaml
kubectl apply -f cloud-config-secret.yaml
取得 OpenStack API 端點的 CA 憑證,並將其放入 /etc/kubernetes/ca.pem
。
建立 RBAC 資源。
kubectl apply -f https://github.com/kubernetes/cloud-provider-openstack/raw/release-1.15/cluster/addons/rbac/cloud-controller-manager-roles.yaml
kubectl apply -f https://github.com/kubernetes/cloud-provider-openstack/raw/release-1.15/cluster/addons/rbac/cloud-controller-manager-role-bindings.yaml
我們將以 DaemonSet 而非 Pod 的形式執行 OpenStack 雲端控制器管理員。管理員只會在控制平面節點上執行,因此如果有多個控制平面節點,則會執行多個 Pod 以實現高可用性。建立包含以下資訊清單的 openstack-cloud-controller-manager-ds.yaml
,然後套用它。
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: cloud-controller-manager
namespace: kube-system
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: openstack-cloud-controller-manager
namespace: kube-system
labels:
k8s-app: openstack-cloud-controller-manager
spec:
selector:
matchLabels:
k8s-app: openstack-cloud-controller-manager
updateStrategy:
type: RollingUpdate
template:
metadata:
labels:
k8s-app: openstack-cloud-controller-manager
spec:
nodeSelector:
node-role.kubernetes.io/master: ""
securityContext:
runAsUser: 1001
tolerations:
- key: node.cloudprovider.kubernetes.io/uninitialized
value: "true"
effect: NoSchedule
- key: node-role.kubernetes.io/master
effect: NoSchedule
- effect: NoSchedule
key: node.kubernetes.io/not-ready
serviceAccountName: cloud-controller-manager
containers:
- name: openstack-cloud-controller-manager
image: docker.io/k8scloudprovider/openstack-cloud-controller-manager:v1.15.0
args:
- /bin/openstack-cloud-controller-manager
- --v=1
- --cloud-config=$(CLOUD_CONFIG)
- --cloud-provider=openstack
- --use-service-account-credentials=true
- --address=127.0.0.1
volumeMounts:
- mountPath: /etc/kubernetes/pki
name: k8s-certs
readOnly: true
- mountPath: /etc/ssl/certs
name: ca-certs
readOnly: true
- mountPath: /etc/config
name: cloud-config-volume
readOnly: true
- mountPath: /usr/libexec/kubernetes/kubelet-plugins/volume/exec
name: flexvolume-dir
- mountPath: /etc/kubernetes
name: ca-cert
readOnly: true
resources:
requests:
cpu: 200m
env:
- name: CLOUD_CONFIG
value: /etc/config/cloud.conf
hostNetwork: true
volumes:
- hostPath:
path: /usr/libexec/kubernetes/kubelet-plugins/volume/exec
type: DirectoryOrCreate
name: flexvolume-dir
- hostPath:
path: /etc/kubernetes/pki
type: DirectoryOrCreate
name: k8s-certs
- hostPath:
path: /etc/ssl/certs
type: DirectoryOrCreate
name: ca-certs
- name: cloud-config-volume
secret:
secretName: cloud-config
- name: ca-cert
secret:
secretName: openstack-ca-cert
當控制器管理員執行時,它將查詢 OpenStack 以取得關於節點的資訊並移除污點。在節點資訊中,您將看到 OpenStack 中 VM 的 UUID。
# kubectl describe no master1
Name: master1
Roles: master
......
Taints: node-role.kubernetes.io/master:NoSchedule
node.kubernetes.io/not-ready:NoSchedule
......
sage:docker: network plugin is not ready: cni config uninitialized
......
PodCIDR: 10.224.0.0/24
ProviderID: openstack:///548e3c46-2477-4ce2-968b-3de1314560a5
現在安裝您喜愛的 CNI,控制平面節點將會就緒。
例如,若要安裝 Weave Net,請執行此命令
kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
接下來,我們將設定工作節點。
首先,以與在控制平面節點中安裝 Docker 和 kubeadm 相同的方式安裝它們。若要將它們加入叢集,我們需要來自控制平面節點安裝輸出的權杖和 ca 憑證雜湊。如果它已過期或遺失,我們可以依照這些命令重新建立它。
# check if token is expired
kubeadm token list
# re-create token and show join command
kubeadm token create --print-join-command
使用上述權杖和 ca 憑證雜湊為工作節點建立 kubeadm-config.yml
。
apiVersion: kubeadm.k8s.io/v1beta2
discovery:
bootstrapToken:
apiServerEndpoint: 192.168.1.7:6443
token: 0c0z4p.dnafh6vnmouus569
caCertHashes: ["sha256:fcb3e956a6880c05fc9d09714424b827f57a6fdc8afc44497180905946527adf"]
kind: JoinConfiguration
nodeRegistration:
kubeletExtraArgs:
cloud-provider: "external"
apiServerEndpoint 是控制平面節點,權杖和 caCertHashes 可以從 'kubeadm token create' 命令輸出中列印的加入命令取得。
執行 kubeadm,工作節點將加入叢集。
kubeadm join --config kubeadm-config.yml
在此階段,我們將擁有一個可運作的 Kubernetes 叢集,並具有外部 OpenStack 雲端供應商。供應商會告知 Kubernetes 關於 Kubernetes 節點和 OpenStack VM 之間的對應關係。如果 Kubernetes 想要將持久性磁碟區掛載到 Pod,它可以從對應關係中找出 Pod 正在哪個 OpenStack VM 上執行,並據此將底層 OpenStack 磁碟區掛載到 VM。
部署 Cinder CSI
與 Cinder 的整合由外部 Cinder CSI 外掛程式提供,如Cinder CSI文件所述。
我們將執行以下步驟來安裝 Cinder CSI 外掛程式。首先,使用 OpenStack API 端點的 CA 憑證建立密鑰。它與我們在上述雲端供應商中使用的憑證檔案相同。
kubectl create secret -n kube-system generic openstack-ca-cert --from-literal=ca.pem="$(cat /etc/kubernetes/ca.pem)" --dry-run -o yaml > openstack-ca-cert.yaml
kubectl apply -f openstack-ca-cert.yaml
然後建立 RBAC 資源。
kubectl apply -f https://raw.githubusercontent.com/kubernetes/cloud-provider-openstack/release-1.15/manifests/cinder-csi-plugin/cinder-csi-controllerplugin-rbac.yaml
kubectl apply -f https://github.com/kubernetes/cloud-provider-openstack/raw/release-1.15/manifests/cinder-csi-plugin/cinder-csi-nodeplugin-rbac.yaml
Cinder CSI 外掛程式包含控制器外掛程式和節點外掛程式。控制器與 Kubernetes API 和 Cinder API 通訊,以建立/掛載/卸載/刪除 Cinder 磁碟區。節點外掛程式反過來在每個工作節點上執行,以將儲存裝置 (已掛載的磁碟區) 繫結到 Pod,並在刪除期間解除繫結。建立 cinder-csi-controllerplugin.yaml
並套用它以建立 csi 控制器。
kind: Service
apiVersion: v1
metadata:
name: csi-cinder-controller-service
namespace: kube-system
labels:
app: csi-cinder-controllerplugin
spec:
selector:
app: csi-cinder-controllerplugin
ports:
- name: dummy
port: 12345
---
kind: StatefulSet
apiVersion: apps/v1
metadata:
name: csi-cinder-controllerplugin
namespace: kube-system
spec:
serviceName: "csi-cinder-controller-service"
replicas: 1
selector:
matchLabels:
app: csi-cinder-controllerplugin
template:
metadata:
labels:
app: csi-cinder-controllerplugin
spec:
serviceAccount: csi-cinder-controller-sa
containers:
- name: csi-attacher
image: quay.io/k8scsi/csi-attacher:v1.0.1
args:
- "--v=5"
- "--csi-address=$(ADDRESS)"
env:
- name: ADDRESS
value: /var/lib/csi/sockets/pluginproxy/csi.sock
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: socket-dir
mountPath: /var/lib/csi/sockets/pluginproxy/
- name: csi-provisioner
image: quay.io/k8scsi/csi-provisioner:v1.0.1
args:
- "--provisioner=csi-cinderplugin"
- "--csi-address=$(ADDRESS)"
env:
- name: ADDRESS
value: /var/lib/csi/sockets/pluginproxy/csi.sock
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: socket-dir
mountPath: /var/lib/csi/sockets/pluginproxy/
- name: csi-snapshotter
image: quay.io/k8scsi/csi-snapshotter:v1.0.1
args:
- "--connection-timeout=15s"
- "--csi-address=$(ADDRESS)"
env:
- name: ADDRESS
value: /var/lib/csi/sockets/pluginproxy/csi.sock
imagePullPolicy: Always
volumeMounts:
- mountPath: /var/lib/csi/sockets/pluginproxy/
name: socket-dir
- name: cinder-csi-plugin
image: docker.io/k8scloudprovider/cinder-csi-plugin:v1.15.0
args :
- /bin/cinder-csi-plugin
- "--v=5"
- "--nodeid=$(NODE_ID)"
- "--endpoint=$(CSI_ENDPOINT)"
- "--cloud-config=$(CLOUD_CONFIG)"
- "--cluster=$(CLUSTER_NAME)"
env:
- name: NODE_ID
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: CSI_ENDPOINT
value: unix://csi/csi.sock
- name: CLOUD_CONFIG
value: /etc/config/cloud.conf
- name: CLUSTER_NAME
value: kubernetes
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: socket-dir
mountPath: /csi
- name: secret-cinderplugin
mountPath: /etc/config
readOnly: true
- mountPath: /etc/kubernetes
name: ca-cert
readOnly: true
volumes:
- name: socket-dir
hostPath:
path: /var/lib/csi/sockets/pluginproxy/
type: DirectoryOrCreate
- name: secret-cinderplugin
secret:
secretName: cloud-config
- name: ca-cert
secret:
secretName: openstack-ca-cert
建立 cinder-csi-nodeplugin.yaml
並套用它以建立 csi 節點。
kind: DaemonSet
apiVersion: apps/v1
metadata:
name: csi-cinder-nodeplugin
namespace: kube-system
spec:
selector:
matchLabels:
app: csi-cinder-nodeplugin
template:
metadata:
labels:
app: csi-cinder-nodeplugin
spec:
serviceAccount: csi-cinder-node-sa
hostNetwork: true
containers:
- name: node-driver-registrar
image: quay.io/k8scsi/csi-node-driver-registrar:v1.1.0
args:
- "--v=5"
- "--csi-address=$(ADDRESS)"
- "--kubelet-registration-path=$(DRIVER_REG_SOCK_PATH)"
lifecycle:
preStop:
exec:
command: ["/bin/sh", "-c", "rm -rf /registration/cinder.csi.openstack.org /registration/cinder.csi.openstack.org-reg.sock"]
env:
- name: ADDRESS
value: /csi/csi.sock
- name: DRIVER_REG_SOCK_PATH
value: /var/lib/kubelet/plugins/cinder.csi.openstack.org/csi.sock
- name: KUBE_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: socket-dir
mountPath: /csi
- name: registration-dir
mountPath: /registration
- name: cinder-csi-plugin
securityContext:
privileged: true
capabilities:
add: ["SYS_ADMIN"]
allowPrivilegeEscalation: true
image: docker.io/k8scloudprovider/cinder-csi-plugin:v1.15.0
args :
- /bin/cinder-csi-plugin
- "--nodeid=$(NODE_ID)"
- "--endpoint=$(CSI_ENDPOINT)"
- "--cloud-config=$(CLOUD_CONFIG)"
env:
- name: NODE_ID
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: CSI_ENDPOINT
value: unix://csi/csi.sock
- name: CLOUD_CONFIG
value: /etc/config/cloud.conf
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: socket-dir
mountPath: /csi
- name: pods-mount-dir
mountPath: /var/lib/kubelet/pods
mountPropagation: "Bidirectional"
- name: kubelet-dir
mountPath: /var/lib/kubelet
mountPropagation: "Bidirectional"
- name: pods-cloud-data
mountPath: /var/lib/cloud/data
readOnly: true
- name: pods-probe-dir
mountPath: /dev
mountPropagation: "HostToContainer"
- name: secret-cinderplugin
mountPath: /etc/config
readOnly: true
- mountPath: /etc/kubernetes
name: ca-cert
readOnly: true
volumes:
- name: socket-dir
hostPath:
path: /var/lib/kubelet/plugins/cinder.csi.openstack.org
type: DirectoryOrCreate
- name: registration-dir
hostPath:
path: /var/lib/kubelet/plugins_registry/
type: Directory
- name: kubelet-dir
hostPath:
path: /var/lib/kubelet
type: Directory
- name: pods-mount-dir
hostPath:
path: /var/lib/kubelet/pods
type: Directory
- name: pods-cloud-data
hostPath:
path: /var/lib/cloud/data
type: Directory
- name: pods-probe-dir
hostPath:
path: /dev
type: Directory
- name: secret-cinderplugin
secret:
secretName: cloud-config
- name: ca-cert
secret:
secretName: openstack-ca-cert
當它們都執行時,為 Cinder 建立儲存類別。
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: csi-sc-cinderplugin
provisioner: csi-cinderplugin
然後我們可以使用此類別建立 PVC。
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: myvol
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: csi-sc-cinderplugin
建立 PVC 時,會對應建立 Cinder 磁碟區。
# kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
myvol Bound pvc-14b8bc68-6c4c-4dc6-ad79-4cb29a81faad 1Gi RWO csi-sc-cinderplugin 3s
在 OpenStack 中,磁碟區名稱將與 Kubernetes 持久性磁碟區產生的名稱相符。在此範例中,它將是:pvc-14b8bc68-6c4c-4dc6-ad79-4cb29a81faad
現在我們可以使用 PVC 建立 Pod。
apiVersion: v1
kind: Pod
metadata:
name: web
spec:
containers:
- name: web
image: nginx
ports:
- name: web
containerPort: 80
hostPort: 8081
protocol: TCP
volumeMounts:
- mountPath: "/usr/share/nginx/html"
name: mypd
volumes:
- name: mypd
persistentVolumeClaim:
claimName: myvol
當 Pod 執行時,磁碟區將掛載到 Pod。如果我們回到 OpenStack,我們可以看到 Cinder 磁碟區已掛載到 Pod 正在執行的工作節點。
# openstack volume show 6b5f3296-b0eb-40cd-bd4f-2067a0d6287f
+--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| attachments | [{u'server_id': u'1c5e1439-edfa-40ed-91fe-2a0e12bc7eb4', u'attachment_id': u'11a15b30-5c24-41d4-86d9-d92823983a32', u'attached_at': u'2019-07-24T05:02:34.000000', u'host_name': u'compute-6', u'volume_id': u'6b5f3296-b0eb-40cd-bd4f-2067a0d6287f', u'device': u'/dev/vdb', u'id': u'6b5f3296-b0eb-40cd-bd4f-2067a0d6287f'}] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2019-07-24T05:02:18.000000 |
| description | Created by OpenStack Cinder CSI driver |
| encrypted | False |
| id | 6b5f3296-b0eb-40cd-bd4f-2067a0d6287f |
| migration_status | None |
| multiattach | False |
| name | pvc-14b8bc68-6c4c-4dc6-ad79-4cb29a81faad |
| os-vol-host-attr:host | rbd:volumes@rbd#rbd |
| os-vol-mig-status-attr:migstat | None |
| os-vol-mig-status-attr:name_id | None |
| os-vol-tenant-attr:tenant_id | 14ba698c0aec4fd6b7dc8c310f664009 |
| properties | attached_mode='rw', cinder.csi.openstack.org/cluster='kubernetes' |
| replication_status | None |
| size | 1 |
| snapshot_id | None |
| source_volid | None |
| status | in-use |
| type | rbd |
| updated_at | 2019-07-24T05:02:35.000000 |
| user_id | 5f6a7a06f4e3456c890130d56babf591 |
+--------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
摘要
在本逐步解說中,我們在 OpenStack VM 上部署了 Kubernetes 叢集,並使用外部 OpenStack 雲端供應商將其與 OpenStack 整合。然後在此 Kubernetes 叢集上,我們部署了 Cinder CSI 外掛程式,該外掛程式可以建立 Cinder 磁碟區,並將其在 Kubernetes 中公開為持久性磁碟區。