You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.4 KiB

  1. # Kube-Registry with GCS storage backend
  2. Besides local file system, docker registry also supports a number of cloud storage backends. Full list of supported backend can be found [here](https://docs.docker.com/registry/configuration/#storage). This document describes how to enable GCS for kube-registry as storage backend.
  3. A few preparation steps are needed.
  4. 1. Create a bucket named kube-registry in GCS.
  5. 1. Create a service account for GCS access and create key file in json format. Detail instruction can be found [here](https://cloud.google.com/storage/docs/authentication#service_accounts).
  6. ### Pack Keyfile into a Secret
  7. Assuming you have downloaded the keyfile as `keyfile.json`. Create secret with the `keyfile.json`...
  8. ```console
  9. $ kubectl --namespace=kube-system create secret generic gcs-key-secret --from-file=keyfile=keyfile.json
  10. ```
  11. ### Run Registry
  12. <!-- BEGIN MUNGE: EXAMPLE registry-gcs-rc.yaml -->
  13. ```yaml
  14. apiVersion: v1
  15. kind: ReplicationController
  16. metadata:
  17. name: kube-registry-v0
  18. namespace: kube-system
  19. labels:
  20. k8s-app: kube-registry
  21. version: v0
  22. # kubernetes.io/cluster-service: "true"
  23. spec:
  24. replicas: 1
  25. selector:
  26. k8s-app: kube-registry
  27. version: v0
  28. template:
  29. metadata:
  30. labels:
  31. k8s-app: kube-registry
  32. version: v0
  33. # kubernetes.io/cluster-service: "true"
  34. spec:
  35. containers:
  36. - name: registry
  37. image: registry:2
  38. resources:
  39. # keep request = limit to keep this container in guaranteed class
  40. limits:
  41. cpu: 100m
  42. memory: 100Mi
  43. requests:
  44. cpu: 100m
  45. memory: 100Mi
  46. env:
  47. - name: REGISTRY_HTTP_ADDR
  48. value: :5000
  49. - name: REGISTRY_STORAGE
  50. value: gcs
  51. - name: REGISTRY_STORAGE_GCS_BUCKET
  52. value: kube-registry
  53. - name: REGISTRY_STORAGE_GCS_KEYFILE
  54. value: /gcs/keyfile
  55. ports:
  56. - containerPort: 5000
  57. name: registry
  58. protocol: TCP
  59. volumeMounts:
  60. - name: gcs-key
  61. mountPath: /gcs
  62. volumes:
  63. - name: gcs-key
  64. secret:
  65. secretName: gcs-key-secret
  66. ```
  67. <!-- END MUNGE: EXAMPLE registry-gcs-rc.yaml -->
  68. No changes are needed for other components (kube-registry service and proxy).
  69. [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/cluster/addons/registry/gcs/README.md?pixel)]()