Skip to content

Commit 1295ea8

Browse files
author
Kamesh Sampath
committed
updated readme with usage instructions
Signed-off-by: Kamesh Sampath <[email protected]>
1 parent 7985d30 commit 1295ea8

File tree

1 file changed

+150
-0
lines changed

1 file changed

+150
-0
lines changed

Diff for: deploy/addons/registry-aliases/README.md

+150
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# Minikube Registry Aliases Addon
2+
3+
An addon to minikube that can help push and pull from the minikube registry using custom domain names. The custom domain names will be made resolveable from with in cluster and at minikube node.
4+
5+
## How to use ?
6+
7+
### Start minikube
8+
9+
```shell
10+
minikube profile demo
11+
minikube start -p demo
12+
```
13+
This addon depends on `registry` addon, it need to be enabled before the alias addon is installed:
14+
15+
### Enable internal registry
16+
17+
```shell
18+
minikube addons enable registry
19+
```
20+
21+
Verifying the registry deployment
22+
23+
```shell
24+
watch kubectl get pods -n kube-system
25+
```
26+
27+
```shell
28+
NAME READY STATUS RESTARTS AGE
29+
coredns-6955765f44-kpbzt 1/1 Running 0 16m
30+
coredns-6955765f44-lzlsv 1/1 Running 0 16m
31+
etcd-demo 1/1 Running 0 16m
32+
kube-apiserver-demo 1/1 Running 0 16m
33+
kube-controller-manager-demo 1/1 Running 0 16m
34+
kube-proxy-q8rb9 1/1 Running 0 16m
35+
kube-scheduler-demo 1/1 Running 0 16m
36+
*registry-4k8zs* 1/1 Running 0 40s
37+
registry-proxy-vs8jt 1/1 Running 0 40s
38+
storage-provisioner 1/1 Running 0 16m
39+
```
40+
41+
```shell
42+
kubectl get svc -n kube-system
43+
```
44+
45+
```shell
46+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
47+
kube-dns ClusterIP 10.96.0.10 <none> 53/UDP,53/TCP,9153/TCP 17m
48+
registry ClusterIP 10.97.247.75 <none> 80/TCP 94s
49+
```
50+
51+
>
52+
> **NOTE:**
53+
> Please make a note of the CLUSTER-IP of `registry` service
54+
55+
### Enable registry aliases addon
56+
57+
```shell
58+
minikube addons enable registry-aliases
59+
🌟 The 'registry-aliases' addon is enabled
60+
```
61+
62+
You can check the mikikube vm's `/etc/hosts` file for the registry aliases entries:
63+
64+
```shell
65+
watch minikube ssh -- cat /etc/hosts
66+
```
67+
68+
```shell
69+
127.0.0.1 localhost
70+
127.0.1.1 demo
71+
10.97.247.75 example.org
72+
10.97.247.75 example.com
73+
10.97.247.75 test.com
74+
10.97.247.75 test.org
75+
```
76+
77+
The above output shows that the Daemonset has added the `registryAliases` from the ConfigMap pointing to the internal registry's __CLUSTER-IP__.
78+
79+
### Update CoreDNS
80+
81+
The coreDNS would have been automatically updated by the patch-coredns. A successful job run will have coredns ConfigMap updated like:
82+
83+
```yaml
84+
apiVersion: v1
85+
data:
86+
Corefile: |-
87+
.:53 {
88+
errors
89+
health
90+
rewrite name example.com registry.kube-system.svc.cluster.local
91+
rewrite name example.org registry.kube-system.svc.cluster.local
92+
rewrite name test.com registry.kube-system.svc.cluster.local
93+
rewrite name test.org registry.kube-system.svc.cluster.local
94+
kubernetes cluster.local in-addr.arpa ip6.arpa {
95+
pods insecure
96+
upstream
97+
fallthrough in-addr.arpa ip6.arpa
98+
}
99+
prometheus :9153
100+
proxy . /etc/resolv.conf
101+
cache 30
102+
loop
103+
reload
104+
loadbalance
105+
}
106+
kind: ConfigMap
107+
metadata:
108+
name: coredns
109+
```
110+
111+
To verify it run the following command:
112+
113+
```shell
114+
kubectl get cm -n kube-system coredns -o yaml
115+
```
116+
117+
Once you have successfully patched you can now push and pull from the registry using suffix `example.com`, `example.org`,`test.com` and `test.org`.
118+
119+
The successful run will show the following extra pods (Daemonset, Job) in `kube-system` namespace:
120+
121+
```shell
122+
NAME READY STATUS RESTARTS AGE
123+
registry-aliases-hosts-update-995vx 1/1 Running 0 47s
124+
registry-aliases-patch-core-dns-zsxfc 0/1 Completed 0 47s
125+
```
126+
127+
## Verify with sample application
128+
129+
You can verify the deployment end to end using the example [application](https://github.com/kameshsampath/minikube-registry-aliases-demo).
130+
131+
```shell
132+
git clone https://github.com/kameshsampath/minikube-registry-aliases-demo
133+
cd minikube-registry-aliases-demo
134+
```
135+
136+
Make sure you set the docker context using `eval $(minikube -p demo docker-env)`
137+
138+
Deploy the application using [Skaffold](https://skaffold.dev):
139+
140+
```shell
141+
skaffold dev --port-forward
142+
```
143+
144+
Once the application is running try doing `curl localhost:8080` to see the `Hello World` response
145+
146+
You can also update [skaffold.yaml](./skaffold.yaml) and [app.yaml](.k8s/app.yaml), to use `test.org`, `test.com` or `example.org` as container registry urls, and see all the container image names resolves to internal registry, resulting in successful build and deployment.
147+
148+
> **NOTE**:
149+
>
150+
> You can also update [skaffold.yaml](./skaffold.yaml) and [app. yaml](.k8s/app.yaml), to use `test.org`, `test.com` or > `example.org` as container registry urls, and see all the > container image names resolves to internal registry, resulting in successful build and deployment.

0 commit comments

Comments
 (0)