您可以在阿里云容器服务 Kubernetes 集群中使用阿里云 OSS 数据卷。
目前,仅支持 OSS 静态存储卷,不支持 OSS 动态存储卷。您可以通过以下方式使用 OSS 静态存储卷:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx-oss-deploy
spec:
replicas: 1
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx-flexvolume-oss
image: nginx
volumeMounts:
- name: "oss1"
mountPath: "/data"
volumes:
- name: "oss1"
flexVolume:
driver: "alicloud/oss"
options:
bucket: "docker"
url: "oss-cn-hangzhou.aliyuncs.com"
akId: ***
akSecret: ***
otherOpts: "-o max_stat_cache_size=0 -o allow_other"
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-oss
spec:
capacity:
storage: 5Gi
accessModes:
- ReadWriteMany
storageClassName: oss
flexVolume:
driver: "alicloud/oss"
options:
bucket: "docker"
url: "oss-cn-hangzhou.aliyuncs.com"
akId: ***
akSecret: ***
otherOpts: "-o max_stat_cache_size=0 -o allow_other"
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-oss
spec:
storageClassName: oss
accessModes:
- ReadWriteMany
resources:
requests:
storage: 5Gi
apiVersion: v1
kind: Pod
metadata:
name: "flexvolume-oss-example"
spec:
containers:
- name: "nginx"
image: "nginx"
volumeMounts:
- name: pvc-oss
mountPath: "/data"
volumes:
- name: pvc-oss
persistentVolumeClaim:
claimName: pvc-oss
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。