Git Product home page Git Product logo

k8s-reset-terminating-pv's Introduction

k8s-reset-terminating-pv

Reset persistent volume status from terminating back to bound. Here are the details.

Purpose

When delete a kubernetes persistent volume by accident, it may stuck in the terminating status due to kubernetes.io/pv-protection finalizer prevent it from being deleted. You can use this tool to reset its status back to bound.

Installing

You can download the latest compiled binary from here.

If you prefer to compile by yourself:

git clone [email protected]:jianz/k8s-reset-terminating-pv.git
cd k8s-reset-terminating-pv
go build -o resetpv

Usage

Usage:
  resetpv [flags] <persistent volume name>

Flags:
      --etcd-ca        string   CA Certificate used by etcd (default "ca.crt")
      --etcd-cert      string   Public key used by etcd (default "etcd.crt")
      --etcd-key       string   Private key used by etcd (default "etcd.key")
      --etcd-host      string   The etcd domain name or IP (default "localhost")
      --etcd-port      int      The etcd port number (default 2379)
      --k8s-key-prefix string   The etcd key prefix for kubernetes resources. (default "registry")
  -h, --help                    help for resetpv

For simplicity, you can name the etcd certificate ca.crt, etcd.crt, etcd.key, and put them in the same directory as the tool(resetpv).

The tool by default connect to etcd using localhost:2379. You can forward the etcd port on the pod to the localhost:

kubectl port-forward pods/etcd-member-master0 2379:2379 -n etcd

--k8s-key-prefix: Default set to registry for the community version of kubernetes as it uses /registry as etcd key prefix, the key for persistent volume pv1 is /registry/persistentvolumes/pv1. Set to kubernetes.io for OpenShift as it uses /kubernetes.io as prefix and the key for pv1 is /kubernetes.io/persistentvolumes/pv1.

Example:

./resetpv --k8s-key-prefix kubernetes.io pv-eef4ec4b-326d-47e6-b11c-6474a5fd4d89

License

k8s-reset-terminating-pv is released under the MIT license.

k8s-reset-terminating-pv's People

Contributors

jianz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.