Configure a Pod to Use a Projected Volume for Storage

网友投稿 225 2022-11-02

Configure a Pod to Use a Projected Volume for Storage

projected.yaml

apiVersion: v1kind: Podmetadata: name: test-projected-volumespec: containers: - name: test-projected-volume image: busybox:1.28 args: - sleep - "86400" volumeMounts: - name: all-in-one mountPath: "/projected-volume" readOnly: true volumes: - name: all-in-one projected: sources: - secret: name: user - secret: name: pass

Create the Secrets

# Create files containing the username and password:echo -n "admin" > ./username.txtecho -n "1f2d1e2e67df" > ./password.txt# Package these files into secrets:kubectl create secret generic user --from-file=./username.txtkubectl create secret generic pass --from-file=./password.txt

Create the Pod

kubectl apply -f projected.yaml

Verify that the Pod’s container is running, and then watch for changes to the Pod

kubectl get --watch pod test-projected-volume

In another terminal, get a shell to the running container

kubectl exec -it test-projected-volume -- /bin/sh

In your shell, verify that the projected-volume directory contains your projected sources

ls /projected-volume/

Clean up

Delete the Pod and the Secrets:

kubectl delete pod test-projected-volumekubectl delete secret user pass

官方文档

​​官网文档​​

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:部署无状态应用程序及升级
下一篇:.NET应用程序可以直接调用WebAssembly模块了
相关文章

 发表评论

暂时没有评论,来抢沙发吧~