mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
Update the DNS template from cluster/addons/dns and combine into one file. Make DNS working on docker and docker-multinode
This commit is contained in:
@@ -32,55 +32,42 @@ Documentation for other releases can be found at
|
||||
|
||||
<!-- END MUNGE: UNVERSIONED_WARNING -->
|
||||
|
||||
## Deploy DNS
|
||||
## Deploy DNS on `docker` and `docker-multinode`
|
||||
|
||||
### Get the template file
|
||||
|
||||
First of all, download the template dns rc and svc file from
|
||||
First of all, download the dns template
|
||||
|
||||
[skydns-rc template](skydns-rc.yaml.in)
|
||||
[skydns template](skydns.yaml.in)
|
||||
|
||||
[skydns-svc template](skydns-svc.yaml.in)
|
||||
### Set environment variables
|
||||
|
||||
### Set env
|
||||
Then you need to set `DNS_REPLICAS`, `DNS_DOMAIN` and `DNS_SERVER_IP` envs
|
||||
|
||||
Then you need to set `DNS_REPLICAS` , `DNS_DOMAIN` , `DNS_SERVER_IP` , `KUBE_SERVER` ENV.
|
||||
|
||||
```
|
||||
```console
|
||||
$ export DNS_REPLICAS=1
|
||||
|
||||
$ export DNS_DOMAIN=cluster.local # specify in startup parameter `--cluster-domain` for containerized kubelet
|
||||
|
||||
$ export DNS_SERVER_IP=10.0.0.10 # specify in startup parameter `--cluster-dns` for containerized kubelet
|
||||
|
||||
$ export KUBE_SERVER=10.10.103.250 # your master server ip, you may change it
|
||||
```
|
||||
|
||||
### Replace the corresponding value in the template.
|
||||
### Replace the corresponding value in the template and create the pod
|
||||
|
||||
```
|
||||
$ sed -e "s/{{ pillar\['dns_replicas'\] }}/${DNS_REPLICAS}/g;s/{{ pillar\['dns_domain'\] }}/${DNS_DOMAIN}/g;s/{kube_server_url}/${KUBE_SERVER}/g;" skydns-rc.yaml.in > ./skydns-rc.yaml
|
||||
```console
|
||||
$ sed -e "s/{{ pillar\['dns_replicas'\] }}/${DNS_REPLICAS}/g;s/{{ pillar\['dns_domain'\] }}/${DNS_DOMAIN}/g;s/{{ pillar\['dns_server'\] }}/${DNS_SERVER_IP}/g" skydns.yaml.in > ./skydns.yaml
|
||||
|
||||
$ sed -e "s/{{ pillar\['dns_server'\] }}/${DNS_SERVER_IP}/g" skydns-svc.yaml.in > ./skydns-svc.yaml
|
||||
```
|
||||
# If the kube-system namespace isn't already created, create it
|
||||
$ kubectl get ns
|
||||
$ kubectl create -f ./kube-system.yaml
|
||||
|
||||
### Use `kubectl` to create skydns rc and service
|
||||
|
||||
|
||||
```
|
||||
$ kubectl -s "$KUBE_SERVER:8080" --namespace=kube-system create -f ./skydns-rc.yaml
|
||||
|
||||
$ kubectl -s "$KUBE_SERVER:8080" --namespace=kube-system create -f ./skydns-svc.yaml
|
||||
$ kubectl create -f ./skydns.yaml
|
||||
```
|
||||
|
||||
### Test if DNS works
|
||||
|
||||
Follow [this link](../../../cluster/addons/dns/#how-do-i-test-if-it-is-working) to check it out.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||
[]()
|
||||
<!-- END MUNGE: GENERATED_ANALYTICS -->
|
||||
|
||||
Reference in New Issue
Block a user