k8s-secret-generator
所属分类:其他
开发工具:GO
文件大小:0KB
下载次数:0
上传日期:2018-09-10 17:50:21
上 传 者:
sh-1993
说明: k8s秘密发生器
(k8s secret generator)
文件列表:
Dockerfile (117, 2018-09-10)
LICENSE (11346, 2018-09-10)
Makefile (243, 2018-09-10)
glide.lock (5795, 2018-09-10)
glide.yaml (108, 2018-09-10)
job.yaml (769, 2018-09-10)
main.go (1559, 2018-09-10)
vendor/ (0, 2018-09-10)
vendor/github.com/ (0, 2018-09-10)
vendor/github.com/ghodss/ (0, 2018-09-10)
vendor/github.com/ghodss/yaml/ (0, 2018-09-10)
vendor/github.com/ghodss/yaml/.travis.yml (66, 2018-09-10)
vendor/github.com/ghodss/yaml/LICENSE (2557, 2018-09-10)
vendor/github.com/ghodss/yaml/fields.go (12650, 2018-09-10)
vendor/github.com/ghodss/yaml/yaml.go (8483, 2018-09-10)
vendor/github.com/ghodss/yaml/yaml_test.go (5388, 2018-09-10)
vendor/github.com/gogo/ (0, 2018-09-10)
vendor/github.com/gogo/protobuf/ (0, 2018-09-10)
vendor/github.com/gogo/protobuf/.mailmap (551, 2018-09-10)
vendor/github.com/gogo/protobuf/.travis.yml (510, 2018-09-10)
vendor/github.com/gogo/protobuf/AUTHORS (548, 2018-09-10)
vendor/github.com/gogo/protobuf/CONTRIBUTORS (667, 2018-09-10)
vendor/github.com/gogo/protobuf/GOLANG_CONTRIBUTORS (218, 2018-09-10)
vendor/github.com/gogo/protobuf/LICENSE (1713, 2018-09-10)
vendor/github.com/gogo/protobuf/Makefile (4835, 2018-09-10)
vendor/github.com/gogo/protobuf/_conformance/ (0, 2018-09-10)
vendor/github.com/gogo/protobuf/_conformance/Makefile (2210, 2018-09-10)
vendor/github.com/gogo/protobuf/_conformance/conformance.go (4995, 2018-09-10)
vendor/github.com/gogo/protobuf/_conformance/conformance_proto/ (0, 2018-09-10)
vendor/github.com/gogo/protobuf/_conformance/conformance_proto/conformance.pb.go (77528, 2018-09-10)
vendor/github.com/gogo/protobuf/_conformance/conformance_proto/conformance.proto (11013, 2018-09-10)
vendor/github.com/gogo/protobuf/bench.md (15386, 2018-09-10)
vendor/github.com/gogo/protobuf/codec/ (0, 2018-09-10)
... ...
# k8s-secret-generator
Generate random data and save it as a Secret within your Kubernetes cluster.
Running `kubectl apply -f job.yaml` would create a Secret similar to the following:
```
apiVersion: v1
kind: Secret
metadata:
creationTimestamp: 2018-09-10T17:10:44Z
name: my-secret
namespace: default
resourceVersion: "692264"
selfLink: /api/v1/namespaces/default/secrets/my-secret
uid: 741ca711-b51c-11e8-a2b3-42010a8a027d
type: Opaque
data:
my-key: M1UyaVIreTI1QWpPcGJDTlkwS0kxdHBuTUZXUThCUzlTaWE1VTBaL3hmOD0=
```
## Params
| Flag | Usage |
| ---- | ----- |
| name | Required. The `metadata.name` for the Secret object. |
| key | The key within the Secret data where the generated secret will be saved. Defaults to `data`. |
| length | Byte length of the secret. Defaults to `32`. |
| base64encode | Encode the random bytes as a base64 string before saving. This is separate to the base64 encoding applied by Kubernetes to store the secret. Default is `false`. |
| namespace | The namespace the Secret will be created in. Defaults to `default`. |
## Authorization
Your default `kubectl` user may not have permission to create the Role and RoleBinding required for the ServiceAccount to create a Secret resource in cluster.
To apply the yaml as an admin user on GKE run the following commands:
```
gcloud container clusters update my-cluster --enable-basic-auth
PASS=$(gcloud container clusters describe my-cluster | grep password | awk '{ print $2 }')
kubectl config set-credentials admin --username=admin --password=$PASS
kubectl --user=admin apply -f job.yaml
```
近期下载者:
相关文件:
收藏者: