5

I want to create PV using the kubectl command line, Is it possible in Kubernetes or not. If it is possible then how?

Jonas
  • 121,568
  • 97
  • 310
  • 388
user15003460
  • 91
  • 1
  • 6
  • You can create whatever resource you like with `kubectl` using `Here documents`. The kubectl [cheat sheet](https://kubernetes.io/docs/reference/kubectl/cheatsheet/) has examples how to apply them. – Ralf Jan 24 '21 at 09:59
  • This document doesn't contain any command to create PV. Can u provide a correct link @Ralf – user15003460 Jan 24 '21 at 14:19
  • I have asked to create PV without creating any file just using a command, read the question carefully and don't downvote if u don't know answer @Ralf – user15003460 Jan 24 '21 at 14:39

1 Answers1

5

For infrastructure, it has become a good practice to use declarative files to provision new infrastructure. Therefore an imperative variant only using kubectl commands for creating Persistent Volumes has not been implemented.

Persistent Volumes are typically created in one of two ways:

  • Automatically created by a dynamic volume provisioning service. What service is used depends on your environment, e.g. on-prem or a cloud provider like Google Cloud Platform or Amazon Web Services.
  • In some cases, created using kubectl and yaml manifests, typically by an operator.
Jonas
  • 121,568
  • 97
  • 310
  • 388