forked from barak/tarpoon
Add glide.yaml and vendor deps
This commit is contained in:
parent
db918f12ad
commit
5b3d5e81bd
18880 changed files with 5166045 additions and 1 deletions
259
vendor/k8s.io/kubernetes/cluster/addons/registry/README.md
generated
vendored
Normal file
259
vendor/k8s.io/kubernetes/cluster/addons/registry/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,259 @@
|
|||
# Private Docker Registry in Kubernetes
|
||||
|
||||
Kubernetes offers an optional private Docker registry addon, which you can turn
|
||||
on when you bring up a cluster or install later. This gives you a place to
|
||||
store truly private Docker images for your cluster.
|
||||
|
||||
## How it works
|
||||
|
||||
The private registry runs as a `Pod` in your cluster. It does not currently
|
||||
support SSL or authentication, which triggers Docker's "insecure registry"
|
||||
logic. To work around this, we run a proxy on each node in the cluster,
|
||||
exposing a port onto the node (via a hostPort), which Docker accepts as
|
||||
"secure", since it is accessed by `localhost`.
|
||||
|
||||
## Turning it on
|
||||
|
||||
Some cluster installs (e.g. GCE) support this as a cluster-birth flag. The
|
||||
`ENABLE_CLUSTER_REGISTRY` variable in `cluster/gce/config-default.sh` governs
|
||||
whether the registry is run or not. To set this flag, you can specify
|
||||
`KUBE_ENABLE_CLUSTER_REGISTRY=true` when running `kube-up.sh`. If your cluster
|
||||
does not include this flag, the following steps should work. Note that some of
|
||||
this is cloud-provider specific, so you may have to customize it a bit.
|
||||
|
||||
### Make some storage
|
||||
|
||||
The primary job of the registry is to store data. To do that we have to decide
|
||||
where to store it. For cloud environments that have networked storage, we can
|
||||
use Kubernetes's `PersistentVolume` abstraction. The following template is
|
||||
expanded by `salt` in the GCE cluster turnup, but can easily be adapted to
|
||||
other situations:
|
||||
|
||||
<!-- BEGIN MUNGE: EXAMPLE registry-pv.yaml.in -->
|
||||
```yaml
|
||||
kind: PersistentVolume
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: kube-system-kube-registry-pv
|
||||
labels:
|
||||
kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
{% if pillar.get('cluster_registry_disk_type', '') == 'gce' %}
|
||||
capacity:
|
||||
storage: {{ pillar['cluster_registry_disk_size'] }}
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
gcePersistentDisk:
|
||||
pdName: "{{ pillar['cluster_registry_disk_name'] }}"
|
||||
fsType: "ext4"
|
||||
{% endif %}
|
||||
```
|
||||
<!-- END MUNGE: EXAMPLE registry-pv.yaml.in -->
|
||||
|
||||
If, for example, you wanted to use NFS you would just need to change the
|
||||
`gcePersistentDisk` block to `nfs`. See
|
||||
[here](../../../docs/user-guide/volumes.md) for more details on volumes.
|
||||
|
||||
Note that in any case, the storage (in the case the GCE PersistentDisk) must be
|
||||
created independently - this is not something Kubernetes manages for you (yet).
|
||||
|
||||
### I don't want or don't have persistent storage
|
||||
|
||||
If you are running in a place that doesn't have networked storage, or if you
|
||||
just want to kick the tires on this without committing to it, you can easily
|
||||
adapt the `ReplicationController` specification below to use a simple
|
||||
`emptyDir` volume instead of a `persistentVolumeClaim`.
|
||||
|
||||
## Claim the storage
|
||||
|
||||
Now that the Kubernetes cluster knows that some storage exists, you can put a
|
||||
claim on that storage. As with the `PersistentVolume` above, you can start
|
||||
with the `salt` template:
|
||||
|
||||
<!-- BEGIN MUNGE: EXAMPLE registry-pvc.yaml.in -->
|
||||
```yaml
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: kube-registry-pvc
|
||||
namespace: kube-system
|
||||
labels:
|
||||
kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ pillar['cluster_registry_disk_size'] }}
|
||||
```
|
||||
<!-- END MUNGE: EXAMPLE registry-pvc.yaml.in -->
|
||||
|
||||
This tells Kubernetes that you want to use storage, and the `PersistentVolume`
|
||||
you created before will be bound to this claim (unless you have other
|
||||
`PersistentVolumes` in which case those might get bound instead). This claim
|
||||
gives you the right to use this storage until you release the claim.
|
||||
|
||||
## Run the registry
|
||||
|
||||
Now we can run a Docker registry:
|
||||
|
||||
<!-- BEGIN MUNGE: EXAMPLE registry-rc.yaml -->
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: ReplicationController
|
||||
metadata:
|
||||
name: kube-registry-v0
|
||||
namespace: kube-system
|
||||
labels:
|
||||
k8s-app: kube-registry
|
||||
version: v0
|
||||
kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
k8s-app: kube-registry
|
||||
version: v0
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: kube-registry
|
||||
version: v0
|
||||
kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
containers:
|
||||
- name: registry
|
||||
image: registry:2
|
||||
resources:
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 100Mi
|
||||
env:
|
||||
- name: REGISTRY_HTTP_ADDR
|
||||
value: :5000
|
||||
- name: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY
|
||||
value: /var/lib/registry
|
||||
volumeMounts:
|
||||
- name: image-store
|
||||
mountPath: /var/lib/registry
|
||||
ports:
|
||||
- containerPort: 5000
|
||||
name: registry
|
||||
protocol: TCP
|
||||
volumes:
|
||||
- name: image-store
|
||||
persistentVolumeClaim:
|
||||
claimName: kube-registry-pvc
|
||||
```
|
||||
<!-- END MUNGE: EXAMPLE registry-rc.yaml -->
|
||||
|
||||
## Expose the registry in the cluster
|
||||
|
||||
Now that we have a registry `Pod` running, we can expose it as a Service:
|
||||
|
||||
<!-- BEGIN MUNGE: EXAMPLE registry-svc.yaml -->
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: kube-registry
|
||||
namespace: kube-system
|
||||
labels:
|
||||
k8s-app: kube-registry
|
||||
kubernetes.io/cluster-service: "true"
|
||||
kubernetes.io/name: "KubeRegistry"
|
||||
spec:
|
||||
selector:
|
||||
k8s-app: kube-registry
|
||||
ports:
|
||||
- name: registry
|
||||
port: 5000
|
||||
protocol: TCP
|
||||
```
|
||||
<!-- END MUNGE: EXAMPLE registry-svc.yaml -->
|
||||
|
||||
## Expose the registry on each node
|
||||
|
||||
Now that we have a running `Service`, we need to expose it onto each Kubernetes
|
||||
`Node` so that Docker will see it as `localhost`. We can load a `Pod` on every
|
||||
node by dropping a YAML file into the kubelet config directory
|
||||
(/etc/kubernetes/manifests by default).
|
||||
|
||||
<!-- BEGIN MUNGE: EXAMPLE ../../saltbase/salt/kube-registry-proxy/kube-registry-proxy.yaml -->
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: kube-registry-proxy
|
||||
namespace: kube-system
|
||||
spec:
|
||||
containers:
|
||||
- name: kube-registry-proxy
|
||||
image: gcr.io/google_containers/kube-registry-proxy:0.3
|
||||
resources:
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 50Mi
|
||||
env:
|
||||
- name: REGISTRY_HOST
|
||||
value: kube-registry.kube-system.svc.cluster.local
|
||||
- name: REGISTRY_PORT
|
||||
value: "5000"
|
||||
- name: FORWARD_PORT
|
||||
value: "5000"
|
||||
ports:
|
||||
- name: registry
|
||||
containerPort: 5000
|
||||
hostPort: 5000
|
||||
```
|
||||
<!-- END MUNGE: EXAMPLE ../../saltbase/salt/kube-registry-proxy/kube-registry-proxy.yaml -->
|
||||
|
||||
This ensures that port 5000 on each node is directed to the registry `Service`.
|
||||
You should be able to verify that it is running by hitting port 5000 with a web
|
||||
browser and getting a 404 error:
|
||||
|
||||
```console
|
||||
$ curl localhost:5000
|
||||
404 page not found
|
||||
```
|
||||
|
||||
## Using the registry
|
||||
|
||||
To use an image hosted by this registry, simply say this in your `Pod`'s
|
||||
`spec.containers[].image` field:
|
||||
|
||||
```yaml
|
||||
image: localhost:5000/user/container
|
||||
```
|
||||
|
||||
Before you can use the registry, you have to be able to get images into it,
|
||||
though. If you are building an image on your Kubernetes `Node`, you can spell
|
||||
out `localhost:5000` when you build and push. More likely, though, you are
|
||||
building locally and want to push to your cluster.
|
||||
|
||||
You can use `kubectl` to set up a port-forward from your local node to a
|
||||
running Pod:
|
||||
|
||||
```console
|
||||
$ POD=$(kubectl get pods --namespace kube-system -l k8s-app=kube-registry \
|
||||
-o template --template '{{range .items}}{{.metadata.name}} {{.status.phase}}{{"\n"}}{{end}}' \
|
||||
| grep Running | head -1 | cut -f1 -d' ')
|
||||
|
||||
$ kubectl port-forward --namespace kube-system $POD 5000:5000 &
|
||||
```
|
||||
|
||||
Now you can build and push images on your local computer as
|
||||
`localhost:5000/yourname/container` and those images will be available inside
|
||||
your kubernetes cluster with the same name.
|
||||
|
||||
# More Extensions
|
||||
|
||||
- [Use GCS as storage backend](gcs/README.md)
|
||||
- [Enable TLS/SSL](tls/README.md)
|
||||
- [Enable Authentication](auth/README.md)
|
||||
|
||||
## Future improvements
|
||||
|
||||
* Allow port-forwarding to a Service rather than a pod (#15180)
|
||||
|
||||
|
||||
[]()
|
||||
92
vendor/k8s.io/kubernetes/cluster/addons/registry/auth/README.md
generated
vendored
Normal file
92
vendor/k8s.io/kubernetes/cluster/addons/registry/auth/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
# Enable Authentication with Htpasswd for Kube-Registry
|
||||
|
||||
Docker registry support a few authentication providers. Full list of supported provider can be found [here](https://docs.docker.com/registry/configuration/#auth). This document describes how to enable authentication with htpasswd for kube-registry.
|
||||
|
||||
### Prepare Htpasswd Secret
|
||||
|
||||
Please generate your own htpasswd file. Assuming the file you generated is `htpasswd`.
|
||||
Creating secret to hold htpasswd...
|
||||
```console
|
||||
$ kubectl --namespace=kube-system create secret generic registry-auth-secret --from-file=htpasswd=htpasswd
|
||||
```
|
||||
|
||||
### Run Registry
|
||||
|
||||
Please be noted that this sample rc is using emptyDir as storage backend for simplicity.
|
||||
|
||||
<!-- BEGIN MUNGE: EXAMPLE registry-auth-rc.yaml -->
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: ReplicationController
|
||||
metadata:
|
||||
name: kube-registry-v0
|
||||
namespace: kube-system
|
||||
labels:
|
||||
k8s-app: kube-registry
|
||||
version: v0
|
||||
# kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
k8s-app: kube-registry
|
||||
version: v0
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: kube-registry
|
||||
version: v0
|
||||
# kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
containers:
|
||||
- name: registry
|
||||
image: registry:2
|
||||
resources:
|
||||
# keep request = limit to keep this container in guaranteed class
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 100Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 100Mi
|
||||
env:
|
||||
- name: REGISTRY_HTTP_ADDR
|
||||
value: :5000
|
||||
- name: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY
|
||||
value: /var/lib/registry
|
||||
- name: REGISTRY_AUTH_HTPASSWD_REALM
|
||||
value: basic_realm
|
||||
- name: REGISTRY_AUTH_HTPASSWD_PATH
|
||||
value: /auth/htpasswd
|
||||
volumeMounts:
|
||||
- name: image-store
|
||||
mountPath: /var/lib/registry
|
||||
- name: auth-dir
|
||||
mountPath: /auth
|
||||
ports:
|
||||
- containerPort: 5000
|
||||
name: registry
|
||||
protocol: TCP
|
||||
volumes:
|
||||
- name: image-store
|
||||
emptyDir: {}
|
||||
- name: auth-dir
|
||||
secret:
|
||||
secretName: registry-auth-secret
|
||||
```
|
||||
<!-- END MUNGE: EXAMPLE registry-auth-rc.yaml -->
|
||||
|
||||
No changes are needed for other components (kube-registry service and proxy).
|
||||
|
||||
### To Verify
|
||||
|
||||
Setup proxy or port-forwarding to the kube-registry. Image push/pull should fail without authentication. Then use `docker login` to authenticate with kube-registry and see if it works.
|
||||
|
||||
### Configure Nodes to Authenticate with Kube-Registry
|
||||
|
||||
By default, nodes assume no authentication is required by kube-registry. Without authentication, nodes cannot pull images from kube-registry. To solve this, more documentation can be found [Here](https://github.com/kubernetes/kubernetes/blob/master/docs/user-guide/images.md#configuring-nodes-to-authenticate-to-a-private-repository)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[]()
|
||||
56
vendor/k8s.io/kubernetes/cluster/addons/registry/auth/registry-auth-rc.yaml
generated
vendored
Normal file
56
vendor/k8s.io/kubernetes/cluster/addons/registry/auth/registry-auth-rc.yaml
generated
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
apiVersion: v1
|
||||
kind: ReplicationController
|
||||
metadata:
|
||||
name: kube-registry-v0
|
||||
namespace: kube-system
|
||||
labels:
|
||||
k8s-app: kube-registry
|
||||
version: v0
|
||||
# kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
k8s-app: kube-registry
|
||||
version: v0
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: kube-registry
|
||||
version: v0
|
||||
# kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
containers:
|
||||
- name: registry
|
||||
image: registry:2
|
||||
resources:
|
||||
# keep request = limit to keep this container in guaranteed class
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 100Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 100Mi
|
||||
env:
|
||||
- name: REGISTRY_HTTP_ADDR
|
||||
value: :5000
|
||||
- name: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY
|
||||
value: /var/lib/registry
|
||||
- name: REGISTRY_AUTH_HTPASSWD_REALM
|
||||
value: basic_realm
|
||||
- name: REGISTRY_AUTH_HTPASSWD_PATH
|
||||
value: /auth/htpasswd
|
||||
volumeMounts:
|
||||
- name: image-store
|
||||
mountPath: /var/lib/registry
|
||||
- name: auth-dir
|
||||
mountPath: /auth
|
||||
ports:
|
||||
- containerPort: 5000
|
||||
name: registry
|
||||
protocol: TCP
|
||||
volumes:
|
||||
- name: image-store
|
||||
emptyDir: {}
|
||||
- name: auth-dir
|
||||
secret:
|
||||
secretName: registry-auth-secret
|
||||
81
vendor/k8s.io/kubernetes/cluster/addons/registry/gcs/README.md
generated
vendored
Normal file
81
vendor/k8s.io/kubernetes/cluster/addons/registry/gcs/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
# Kube-Registry with GCS storage backend
|
||||
|
||||
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.
|
||||
|
||||
A few preparation steps are needed.
|
||||
1. Create a bucket named kube-registry in GCS.
|
||||
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).
|
||||
|
||||
|
||||
### Pack Keyfile into a Secret
|
||||
|
||||
Assuming you have downloaded the keyfile as `keyfile.json`. Create secret with the `keyfile.json`...
|
||||
```console
|
||||
$ kubectl --namespace=kube-system create secret generic gcs-key-secret --from-file=keyfile=keyfile.json
|
||||
```
|
||||
|
||||
|
||||
### Run Registry
|
||||
|
||||
<!-- BEGIN MUNGE: EXAMPLE registry-gcs-rc.yaml -->
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: ReplicationController
|
||||
metadata:
|
||||
name: kube-registry-v0
|
||||
namespace: kube-system
|
||||
labels:
|
||||
k8s-app: kube-registry
|
||||
version: v0
|
||||
# kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
k8s-app: kube-registry
|
||||
version: v0
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: kube-registry
|
||||
version: v0
|
||||
# kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
containers:
|
||||
- name: registry
|
||||
image: registry:2
|
||||
resources:
|
||||
# keep request = limit to keep this container in guaranteed class
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 100Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 100Mi
|
||||
env:
|
||||
- name: REGISTRY_HTTP_ADDR
|
||||
value: :5000
|
||||
- name: REGISTRY_STORAGE
|
||||
value: gcs
|
||||
- name: REGISTRY_STORAGE_GCS_BUCKET
|
||||
value: kube-registry
|
||||
- name: REGISTRY_STORAGE_GCS_KEYFILE
|
||||
value: /gcs/keyfile
|
||||
ports:
|
||||
- containerPort: 5000
|
||||
name: registry
|
||||
protocol: TCP
|
||||
volumeMounts:
|
||||
- name: gcs-key
|
||||
mountPath: /gcs
|
||||
volumes:
|
||||
- name: gcs-key
|
||||
secret:
|
||||
secretName: gcs-key-secret
|
||||
```
|
||||
<!-- END MUNGE: EXAMPLE registry-gcs-rc.yaml -->
|
||||
|
||||
|
||||
No changes are needed for other components (kube-registry service and proxy).
|
||||
|
||||
|
||||
[]()
|
||||
52
vendor/k8s.io/kubernetes/cluster/addons/registry/gcs/registry-gcs-rc.yaml
generated
vendored
Normal file
52
vendor/k8s.io/kubernetes/cluster/addons/registry/gcs/registry-gcs-rc.yaml
generated
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
apiVersion: v1
|
||||
kind: ReplicationController
|
||||
metadata:
|
||||
name: kube-registry-v0
|
||||
namespace: kube-system
|
||||
labels:
|
||||
k8s-app: kube-registry
|
||||
version: v0
|
||||
# kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
k8s-app: kube-registry
|
||||
version: v0
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: kube-registry
|
||||
version: v0
|
||||
# kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
containers:
|
||||
- name: registry
|
||||
image: registry:2
|
||||
resources:
|
||||
# keep request = limit to keep this container in guaranteed class
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 100Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 100Mi
|
||||
env:
|
||||
- name: REGISTRY_HTTP_ADDR
|
||||
value: :5000
|
||||
- name: REGISTRY_STORAGE
|
||||
value: gcs
|
||||
- name: REGISTRY_STORAGE_GCS_BUCKET
|
||||
value: kube-registry
|
||||
- name: REGISTRY_STORAGE_GCS_KEYFILE
|
||||
value: /gcs/keyfile
|
||||
ports:
|
||||
- containerPort: 5000
|
||||
name: registry
|
||||
protocol: TCP
|
||||
volumeMounts:
|
||||
- name: gcs-key
|
||||
mountPath: /gcs
|
||||
volumes:
|
||||
- name: gcs-key
|
||||
secret:
|
||||
secretName: gcs-key-secret
|
||||
26
vendor/k8s.io/kubernetes/cluster/addons/registry/images/Dockerfile
generated
vendored
Normal file
26
vendor/k8s.io/kubernetes/cluster/addons/registry/images/Dockerfile
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# Copyright 2016 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
FROM haproxy:1.5
|
||||
MAINTAINER Muhammed Uluyol <uluyol@google.com>
|
||||
|
||||
RUN apt-get update && apt-get install -y dnsutils
|
||||
|
||||
ADD proxy.conf.insecure.in /proxy.conf.in
|
||||
ADD run_proxy.sh /usr/bin/run_proxy
|
||||
|
||||
RUN chown root:users /usr/bin/run_proxy
|
||||
RUN chmod 755 /usr/bin/run_proxy
|
||||
|
||||
CMD ["/usr/bin/run_proxy"]
|
||||
24
vendor/k8s.io/kubernetes/cluster/addons/registry/images/Makefile
generated
vendored
Normal file
24
vendor/k8s.io/kubernetes/cluster/addons/registry/images/Makefile
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# Copyright 2016 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
.PHONY: build push vet test clean
|
||||
|
||||
TAG = 0.3
|
||||
REPO = gcr.io/google_containers/kube-registry-proxy
|
||||
|
||||
build:
|
||||
docker build -t $(REPO):$(TAG) .
|
||||
|
||||
push:
|
||||
gcloud docker -- push $(REPO):$(TAG)
|
||||
17
vendor/k8s.io/kubernetes/cluster/addons/registry/images/proxy.conf.in
generated
vendored
Normal file
17
vendor/k8s.io/kubernetes/cluster/addons/registry/images/proxy.conf.in
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
global
|
||||
maxconn 1024
|
||||
|
||||
defaults
|
||||
mode http
|
||||
retries 3
|
||||
option redispatch
|
||||
timeout client 1s
|
||||
timeout server 5s
|
||||
timeout connect 5s
|
||||
|
||||
frontend forwarder
|
||||
bind *:%FWDPORT%
|
||||
default_backend registry
|
||||
|
||||
backend registry
|
||||
server kube-registry %HOST%:%PORT% ssl verify required ca-file %CA_FILE%
|
||||
17
vendor/k8s.io/kubernetes/cluster/addons/registry/images/proxy.conf.insecure.in
generated
vendored
Normal file
17
vendor/k8s.io/kubernetes/cluster/addons/registry/images/proxy.conf.insecure.in
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
global
|
||||
maxconn 1024
|
||||
|
||||
defaults
|
||||
mode http
|
||||
retries 3
|
||||
option redispatch
|
||||
timeout client 1s
|
||||
timeout server 5s
|
||||
timeout connect 5s
|
||||
|
||||
frontend forwarder
|
||||
bind *:%FWDPORT%
|
||||
default_backend registry
|
||||
|
||||
backend registry
|
||||
server kube-registry %HOST%:%PORT%
|
||||
33
vendor/k8s.io/kubernetes/cluster/addons/registry/images/run_proxy.sh
generated
vendored
Normal file
33
vendor/k8s.io/kubernetes/cluster/addons/registry/images/run_proxy.sh
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env bash
|
||||
# Copyright 2015 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
REGISTRY_HOST=${REGISTRY_HOST:?no host}
|
||||
REGISTRY_PORT=${REGISTRY_PORT:-5000}
|
||||
REGISTRY_CA=${REGISTRY_CA:-/var/run/secrets/kubernetes.io/serviceaccount/ca.crt}
|
||||
FORWARD_PORT=${FORWARD_PORT:-5000}
|
||||
sed -e "s/%HOST%/$REGISTRY_HOST/g" \
|
||||
-e "s/%PORT%/$REGISTRY_PORT/g" \
|
||||
-e "s/%FWDPORT%/$FORWARD_PORT/g" \
|
||||
-e "s|%CA_FILE%|$REGISTRY_CA|g" \
|
||||
</proxy.conf.in >/proxy.conf
|
||||
|
||||
# wait for registry to come online
|
||||
while ! host "$REGISTRY_HOST" &>/dev/null; do
|
||||
printf "waiting for %s to come online\n" "$REGISTRY_HOST"
|
||||
sleep 1
|
||||
done
|
||||
|
||||
printf "starting proxy\n"
|
||||
exec haproxy -f /proxy.conf "$@"
|
||||
16
vendor/k8s.io/kubernetes/cluster/addons/registry/registry-pv.yaml.in
generated
vendored
Normal file
16
vendor/k8s.io/kubernetes/cluster/addons/registry/registry-pv.yaml.in
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
kind: PersistentVolume
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: kube-system-kube-registry-pv
|
||||
labels:
|
||||
kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
{% if pillar.get('cluster_registry_disk_type', '') == 'gce' %}
|
||||
capacity:
|
||||
storage: {{ pillar['cluster_registry_disk_size'] }}
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
gcePersistentDisk:
|
||||
pdName: "{{ pillar['cluster_registry_disk_name'] }}"
|
||||
fsType: "ext4"
|
||||
{% endif %}
|
||||
13
vendor/k8s.io/kubernetes/cluster/addons/registry/registry-pvc.yaml.in
generated
vendored
Normal file
13
vendor/k8s.io/kubernetes/cluster/addons/registry/registry-pvc.yaml.in
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: kube-registry-pvc
|
||||
namespace: kube-system
|
||||
labels:
|
||||
kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ pillar['cluster_registry_disk_size'] }}
|
||||
48
vendor/k8s.io/kubernetes/cluster/addons/registry/registry-rc.yaml
generated
vendored
Normal file
48
vendor/k8s.io/kubernetes/cluster/addons/registry/registry-rc.yaml
generated
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
apiVersion: v1
|
||||
kind: ReplicationController
|
||||
metadata:
|
||||
name: kube-registry-v0
|
||||
namespace: kube-system
|
||||
labels:
|
||||
k8s-app: kube-registry
|
||||
version: v0
|
||||
kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
k8s-app: kube-registry
|
||||
version: v0
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: kube-registry
|
||||
version: v0
|
||||
kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
containers:
|
||||
- name: registry
|
||||
image: registry:2.5.1
|
||||
resources:
|
||||
# keep request = limit to keep this container in guaranteed class
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 100Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 100Mi
|
||||
env:
|
||||
- name: REGISTRY_HTTP_ADDR
|
||||
value: :5000
|
||||
- name: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY
|
||||
value: /var/lib/registry
|
||||
volumeMounts:
|
||||
- name: image-store
|
||||
mountPath: /var/lib/registry
|
||||
ports:
|
||||
- containerPort: 5000
|
||||
name: registry
|
||||
protocol: TCP
|
||||
volumes:
|
||||
- name: image-store
|
||||
persistentVolumeClaim:
|
||||
claimName: kube-registry-pvc
|
||||
16
vendor/k8s.io/kubernetes/cluster/addons/registry/registry-svc.yaml
generated
vendored
Normal file
16
vendor/k8s.io/kubernetes/cluster/addons/registry/registry-svc.yaml
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: kube-registry
|
||||
namespace: kube-system
|
||||
labels:
|
||||
k8s-app: kube-registry
|
||||
kubernetes.io/cluster-service: "true"
|
||||
kubernetes.io/name: "KubeRegistry"
|
||||
spec:
|
||||
selector:
|
||||
k8s-app: kube-registry
|
||||
ports:
|
||||
- name: registry
|
||||
port: 5000
|
||||
protocol: TCP
|
||||
116
vendor/k8s.io/kubernetes/cluster/addons/registry/tls/README.md
generated
vendored
Normal file
116
vendor/k8s.io/kubernetes/cluster/addons/registry/tls/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
# Enable TLS for Kube-Registry
|
||||
|
||||
This document describes how to enable TLS for kube-registry. Before you start, please check if you have all the prerequisite:
|
||||
|
||||
- A domain for kube-registry. Assuming it is ` myregistrydomain.com`.
|
||||
- Domain certificate and key. Assuming they are `domain.crt` and `domain.key`
|
||||
|
||||
### Pack domain.crt and domain.key into a Secret
|
||||
|
||||
```console
|
||||
$ kubectl --namespace=kube-system create secret generic registry-tls-secret --from-file=domain.crt=domain.crt --from-file=domain.key=domain.key
|
||||
```
|
||||
|
||||
### Run Registry
|
||||
|
||||
Please be noted that this sample rc is using emptyDir as storage backend for simplicity.
|
||||
|
||||
<!-- BEGIN MUNGE: EXAMPLE registry-tls-rc.yaml -->
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: ReplicationController
|
||||
metadata:
|
||||
name: kube-registry-v0
|
||||
namespace: kube-system
|
||||
labels:
|
||||
k8s-app: kube-registry
|
||||
version: v0
|
||||
# kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
k8s-app: kube-registry
|
||||
version: v0
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: kube-registry
|
||||
version: v0
|
||||
# kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
containers:
|
||||
- name: registry
|
||||
image: registry:2
|
||||
resources:
|
||||
# keep request = limit to keep this container in guaranteed class
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 100Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 100Mi
|
||||
env:
|
||||
- name: REGISTRY_HTTP_ADDR
|
||||
value: :5000
|
||||
- name: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY
|
||||
value: /var/lib/registry
|
||||
- name: REGISTRY_HTTP_TLS_CERTIFICATE
|
||||
value: /certs/domain.crt
|
||||
- name: REGISTRY_HTTP_TLS_KEY
|
||||
value: /certs/domain.key
|
||||
volumeMounts:
|
||||
- name: image-store
|
||||
mountPath: /var/lib/registry
|
||||
- name: cert-dir
|
||||
mountPath: /certs
|
||||
ports:
|
||||
- containerPort: 5000
|
||||
name: registry
|
||||
protocol: TCP
|
||||
volumes:
|
||||
- name: image-store
|
||||
emptyDir: {}
|
||||
- name: cert-dir
|
||||
secret:
|
||||
secretName: registry-tls-secret
|
||||
```
|
||||
<!-- END MUNGE: EXAMPLE registry-tls-rc.yaml -->
|
||||
|
||||
### Expose External IP for Kube-Registry
|
||||
|
||||
Modify the default kube-registry service to `LoadBalancer` type and point the DNS record of `myregistrydomain.com` to the service external ip.
|
||||
|
||||
<!-- BEGIN MUNGE: EXAMPLE registry-tls-svc.yaml -->
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: kube-registry
|
||||
namespace: kube-system
|
||||
labels:
|
||||
k8s-app: kube-registry
|
||||
# kubernetes.io/cluster-service: "true"
|
||||
kubernetes.io/name: "KubeRegistry"
|
||||
spec:
|
||||
selector:
|
||||
k8s-app: kube-registry
|
||||
type: LoadBalancer
|
||||
ports:
|
||||
- name: registry
|
||||
port: 5000
|
||||
protocol: TCP
|
||||
```
|
||||
<!-- END MUNGE: EXAMPLE registry-tls-svc.yaml -->
|
||||
|
||||
### To Verify
|
||||
|
||||
Now you should be able to access your kube-registry from another docker host.
|
||||
```console
|
||||
docker pull busybox
|
||||
docker tag busybox myregistrydomain.com:5000/busybox
|
||||
docker push myregistrydomain.com:5000/busybox
|
||||
docker pull myregistrydomain.com:5000/busybox
|
||||
```
|
||||
|
||||
|
||||
[]()
|
||||
57
vendor/k8s.io/kubernetes/cluster/addons/registry/tls/registry-tls-rc.yaml
generated
vendored
Normal file
57
vendor/k8s.io/kubernetes/cluster/addons/registry/tls/registry-tls-rc.yaml
generated
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
apiVersion: v1
|
||||
kind: ReplicationController
|
||||
metadata:
|
||||
name: kube-registry-v0
|
||||
namespace: kube-system
|
||||
labels:
|
||||
k8s-app: kube-registry
|
||||
version: v0
|
||||
# kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
k8s-app: kube-registry
|
||||
version: v0
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: kube-registry
|
||||
version: v0
|
||||
# kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
containers:
|
||||
- name: registry
|
||||
image: registry:2
|
||||
resources:
|
||||
# keep request = limit to keep this container in guaranteed class
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 100Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 100Mi
|
||||
env:
|
||||
- name: REGISTRY_HTTP_ADDR
|
||||
value: :5000
|
||||
- name: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY
|
||||
value: /var/lib/registry
|
||||
- name: REGISTRY_HTTP_TLS_CERTIFICATE
|
||||
value: /certs/domain.crt
|
||||
- name: REGISTRY_HTTP_TLS_KEY
|
||||
value: /certs/domain.key
|
||||
volumeMounts:
|
||||
- name: image-store
|
||||
mountPath: /var/lib/registry
|
||||
- name: cert-dir
|
||||
mountPath: /certs
|
||||
ports:
|
||||
- containerPort: 5000
|
||||
name: registry
|
||||
protocol: TCP
|
||||
volumes:
|
||||
- name: image-store
|
||||
emptyDir: {}
|
||||
- name: cert-dir
|
||||
secret:
|
||||
secretName: registry-tls-secret
|
||||
|
||||
17
vendor/k8s.io/kubernetes/cluster/addons/registry/tls/registry-tls-svc.yaml
generated
vendored
Normal file
17
vendor/k8s.io/kubernetes/cluster/addons/registry/tls/registry-tls-svc.yaml
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: kube-registry
|
||||
namespace: kube-system
|
||||
labels:
|
||||
k8s-app: kube-registry
|
||||
# kubernetes.io/cluster-service: "true"
|
||||
kubernetes.io/name: "KubeRegistry"
|
||||
spec:
|
||||
selector:
|
||||
k8s-app: kube-registry
|
||||
type: LoadBalancer
|
||||
ports:
|
||||
- name: registry
|
||||
port: 5000
|
||||
protocol: TCP
|
||||
Loading…
Add table
Add a link
Reference in a new issue