项目作者: zzzsochi

项目描述 :
Docker image with awscli, kubectl and some utils
高级语言: Shell
项目地址: git://github.com/zzzsochi/kubeawsctl.git
创建时间: 2019-01-05T15:59:39Z
项目社区:https://github.com/zzzsochi/kubeawsctl

开源协议:

下载


Docker image with awscli, kubectl and some utils

Usage

  1. ---
  2. kind: CronJob
  3. apiVersion: batch/v1beta1
  4. metadata:
  5. name: update-ecr-secret
  6. spec:
  7. schedule: "30 */3 * * *"
  8. jobTemplate:
  9. spec:
  10. template:
  11. spec:
  12. restartPolicy: OnFailure
  13. containers:
  14. - name: updater
  15. image: zzzsochi/kubeawsctl
  16. command: ["/usr/local/bin/update_ecr_secret"]
  17. env:
  18. - name: KUBE_TOKEN
  19. valueFrom:
  20. secretKeyRef:
  21. name: drone-token-kxbqc
  22. key: token
  23. - name: AWS_ACCESS_KEY_ID
  24. valueFrom:
  25. secretKeyRef:
  26. name: aws
  27. key: id
  28. - name: AWS_SECRET_ACCESS_KEY
  29. valueFrom:
  30. secretKeyRef:
  31. name: aws
  32. key: secret
  33. - name: AWS_DEFAULT_REGION
  34. valueFrom:
  35. secretKeyRef:
  36. name: aws
  37. key: region
  38. - name: ECR_REGISTRY
  39. value: 682366063701.dkr.ecr.us-east-2.amazonaws.com
  40. - name: KUBE_ECR_SECRET_NAME
  41. value: ecr

/usr/local/bin/kubesetup

Setup kubectl. Need to set KUBE_TOKEN variable.

  1. docker run -it --rm -e KUBE_TOKEN=$(kubectl get secret my-super-token -o jsonpath='{.data.token}') zzzsochi@kubeawsctl
  2. kubesetup
  3. kubectl get all

Variable KUBE_SERVER set the kubernetes server. Default: https://kubernetes.default.svc.cluster.local

/usr/local/bin/update_ecr_secret

Need to set KUBE_TOKEN, ECR_REGISTRY and KUBE_ECR_SECRET_NAME.
Also you need to setup awscli environtment variables:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • AWS_DEFAULT_REGION