kubernetes示例澄清中Hostpath卷的快照

问题描述 投票:0回答:1

我在Azure VM中有一个K8s集群,运行Ubuntu 18.集群是使用召唤来配置的。

我正在尝试测试kubernetes快照功能。试着按照这里的步骤:https://github.com/kubernetes-incubator/external-storage/blob/master/snapshot/doc/examples/hostpath/README.md

虽然我可以按照页面上的大多数说明操作,但不确定此特定命令的作用:

"_output/bin/snapshot-controller  -kubeconfig=${HOME}/.kube/config"

直接执行此指令不起作用。

任何人都可以解释这是什么以及如何成功运行此部分?或者更好的是,如果它存在,则指向完整的演练。


更新

尝试从https://github.com/kubernetes-incubator/external-storage/tree/master/snapshot/deploy/kubernetes/hostpath步骤

由于未使用RBAC,因此在下面列出了注释

#serviceAccountName:snapshot-controller-runner

然后部署使用

kubectl create -f deployment.yaml

kubectl create -f pv.yaml

kubectl create -f pvc.yaml

kubectl create -f snapshot.yaml

这些yaml来自'原样':

GitHub.com/苦逼儿呢特殊-incubator/external-storage/blob/master/snapshot/doc/examples/host path/

kubectl describe volumesnapshot snapshot-demo             Name:         snapshot-demo
Namespace:    default
Labels:       SnapshotMetadata-PVName=hostpath-pv
              SnapshotMetadata-Timestamp=1555999582450832931
Annotations:  <none>
API Version:  volumesnapshot.external-storage.k8s.io/v1
Kind:         VolumeSnapshot
Metadata:
  Creation Timestamp:  2019-04-23T05:56:05Z
  Generation:          2
  Resource Version:    261433
  Self Link:           /apis/volumesnapshot.external-storage.k8s.io/v1/namespaces/default/volumesnapshots/snapshot-demo
  UID:                 7b89194a-658c-11e9-86b2-000d3a07ff79
Spec:
  Persistent Volume Claim Name:  hostpath-pvc
  Snapshot Data Name:
Status:
  Conditions:          <nil>
  Creation Timestamp:  <nil>
Events:                <none>

但是创建了快照资源,但未创建volumesnapshotdata。

kubectl get volumesnapshotdata
No resources found.
kubectl get crd
NAME                                                         CREATED AT
volumesnapshotdatas.volumesnapshot.external-storage.k8s.io   2019-04-21T04:18:54Z
volumesnapshots.volumesnapshot.external-storage.k8s.io       2019-04-21T04:18:54Z
kubectl get pod
NAME                                   READY   STATUS    RESTARTS   AGE
azure                                  1/1     Running   2          2d21h
azure-2                                1/1     Running   2          2d20h
snapshot-controller-5d798696ff-qsh6m   2/2     Running   2          14h

ls /tmp/test/
data

已启用卷快照的功能门

cat /var/snap/kube-apiserver/924/args

--advertise-address="192.168.0.4"
--min-request-timeout="300"
--etcd-cafile="/root/cdk/etcd/client-ca.pem"
--etcd-certfile="/root/cdk/etcd/client-cert.pem"
--etcd-keyfile="/root/cdk/etcd/client-key.pem"
--etcd-servers="https://192.168.0.4:2379"
--storage-backend="etcd3"
--tls-cert-file="/root/cdk/server.crt"
--tls-private-key-file="/root/cdk/server.key"
--insecure-bind-address="127.0.0.1"
--insecure-port="8080"
--audit-log-maxbackup="9"
--audit-log-maxsize="100"
--audit-log-path="/root/cdk/audit/audit.log"
--audit-policy-file="/root/cdk/audit/audit-policy.yaml"
--basic-auth-file="/root/cdk/basic_auth.csv"
--client-ca-file="/root/cdk/ca.crt"
--requestheader-allowed-names="system:kube-apiserver"
--requestheader-client-ca-file="/root/cdk/ca.crt"
--requestheader-extra-headers-prefix="X-Remote-Extra-"
--requestheader-group-headers="X-Remote-Group"
--requestheader-username-headers="X-Remote-User"
--service-account-key-file="/root/cdk/serviceaccount.key"
--token-auth-file="/root/cdk/known_tokens.csv"
--authorization-mode="AlwaysAllow"
--admission-control="NamespaceLifecycle,LimitRanger,ServiceAccount,PersistentVolumeLabel,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
--allow-privileged=true
--enable-aggregator-routing
--kubelet-certificate-authority="/root/cdk/ca.crt"
--kubelet-client-certificate="/root/cdk/client.crt"
--kubelet-client-key="/root/cdk/client.key"
--kubelet-preferred-address-types="[InternalIP,Hostname,InternalDNS,ExternalDNS,ExternalIP]"
--proxy-client-cert-file="/root/cdk/client.crt"
--proxy-client-key-file="/root/cdk/client.key"
--service-cluster-ip-range="10.152.183.0/24"
--logtostderr
--v="4"
--feature-gates="VolumeSnapshotDataSource=true"

我在这里失踪了什么?

kubernetes
1个回答
0
投票

我认为你需要的一切已经存在于此:https://github.com/kubernetes-incubator/external-storage/tree/master/snapshot/deploy/kubernetes/hostpath

有一个YAML用于部署快照控制器,一个YAML用于快照器RBAC规则。

© www.soinside.com 2019 - 2024. All rights reserved.