Skip to content

Commit

Permalink
Merge pull request kubernetes#21504 from luxas/fix_certs_for_hyperkube
Browse files Browse the repository at this point in the history
Auto commit by PR queue bot
  • Loading branch information
k8s-merge-robot committed Feb 26, 2016
2 parents ce48ec7 + e9af6c3 commit 766657c
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 61 deletions.
2 changes: 1 addition & 1 deletion cluster/addons/dns/skydns-rc.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
spec:
containers:
- name: etcd
image: gcr.io/google_containers/etcd:2.0.9
image: gcr.io/google_containers/etcd-amd64:2.2.1
resources:
# keep request = limit to keep this container in guaranteed class
limits:
Expand Down
2 changes: 1 addition & 1 deletion cluster/images/hyperkube/master-multi.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"image": "gcr.io/google_containers/hyperkube-ARCH:VERSION",
"command": [
"/setup-files.sh",
"IP:10.0.0.1"
"IP:10.0.0.1,DNS:kubernetes,DNS:kubernetes.default,DNS:kubernetes.default.svc,DNS:kubernetes.default.svc.cluster.local"
],
"volumeMounts": [
{
Expand Down
2 changes: 1 addition & 1 deletion cluster/images/hyperkube/master.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"image": "gcr.io/google_containers/hyperkube-ARCH:VERSION",
"command": [
"/setup-files.sh",
"IP:10.0.0.1"
"IP:10.0.0.1,DNS:kubernetes,DNS:kubernetes.default,DNS:kubernetes.default.svc,DNS:kubernetes.default.svc.cluster.local"
],
"volumeMounts": [
{
Expand Down
4 changes: 3 additions & 1 deletion cluster/images/hyperkube/setup-files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ echo "admin,admin,admin" > /data/basic_auth.csv

# Create HTTPS certificates
groupadd -f -r kube-cert-test
CERT_DIR=/data CERT_GROUP=kube-cert-test /make-ca-cert.sh $(hostname -i) ${EXTRA_SANS}

# hostname -I gets the ip of the node
CERT_DIR=/data CERT_GROUP=kube-cert-test /make-ca-cert.sh $(hostname -I | awk '{print $1}') ${EXTRA_SANS}

# Create known tokens for service accounts
echo "$(create_token),admin,admin" >> /data/known_tokens.csv
Expand Down
39 changes: 13 additions & 26 deletions docs/getting-started-guides/docker-multinode/deployDNS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

```
$ 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
$ sed -e "s/{{ pillar\['dns_server'\] }}/${DNS_SERVER_IP}/g" skydns-svc.yaml.in > ./skydns-svc.yaml
```
### Replace the corresponding value in the template and create the pod

### Use `kubectl` to create skydns rc and service
```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

# If the kube-system namespace isn't already created, create it
$ kubectl get ns
$ kubectl create -f ./kube-system.yaml

```
$ 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 -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/getting-started-guides/docker-multinode/deployDNS.md?pixel)]()
<!-- END MUNGE: GENERATED_ANALYTICS -->
4 changes: 4 additions & 0 deletions docs/getting-started-guides/docker-multinode/kube-system.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: kube-system
20 changes: 0 additions & 20 deletions docs/getting-started-guides/docker-multinode/skydns-svc.yaml.in

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: kube-dns-v8
name: kube-dns-v10
namespace: kube-system
labels:
k8s-app: kube-dns
version: v8
version: v10
kubernetes.io/cluster-service: "true"
spec:
replicas: {{ pillar['dns_replicas'] }}
selector:
k8s-app: kube-dns
version: v8
version: v10
template:
metadata:
labels:
k8s-app: kube-dns
version: v8
version: v10
kubernetes.io/cluster-service: "true"
spec:
containers:
- name: etcd
image: gcr.io/google_containers/etcd:2.0.9
image: gcr.io/google_containers/etcd-amd64:2.2.1
resources:
# keep request = limit to keep this container in guaranteed class
limits:
cpu: 100m
memory: 50Mi
requests:
cpu: 100m
memory: 50Mi
command:
- /usr/local/bin/etcd
- -data-dir
Expand All @@ -40,25 +44,33 @@ spec:
- name: etcd-storage
mountPath: /var/etcd/data
- name: kube2sky
image: gcr.io/google_containers/kube2sky:1.11
image: gcr.io/google_containers/kube2sky:1.12
resources:
# keep request = limit to keep this container in guaranteed class
limits:
cpu: 100m
memory: 50Mi
requests:
cpu: 100m
memory: 50Mi
args:
# command = "/kube2sky"
- -domain={{ pillar['dns_domain'] }}
- -kube_master_url=http://{kube_server_url}:8080
- --domain={{ pillar['dns_domain'] }}
- name: skydns
image: gcr.io/google_containers/skydns:2015-03-11-001
image: gcr.io/google_containers/skydns:2015-10-13-8c72f8c
resources:
# keep request = limit to keep this container in guaranteed class
limits:
cpu: 100m
memory: 50Mi
requests:
cpu: 100m
memory: 50Mi
args:
# command = "/skydns"
- -machines=http://localhost:4001
- -machines=http://127.0.0.1:4001
- -addr=0.0.0.0:53
- -ns-rotate=false
- -domain={{ pillar['dns_domain'] }}.
ports:
- containerPort: 53
Expand All @@ -74,14 +86,25 @@ spec:
scheme: HTTP
initialDelaySeconds: 30
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /healthz
port: 8080
scheme: HTTP
initialDelaySeconds: 1
timeoutSeconds: 5
- name: healthz
image: gcr.io/google_containers/exechealthz:1.0
resources:
# keep request = limit to keep this container in guaranteed class
limits:
cpu: 10m
memory: 20Mi
requests:
cpu: 10m
memory: 20Mi
args:
- -cmd=nslookup kubernetes.default.svc.{{ pillar['dns_domain'] }} localhost >/dev/null
- -cmd=nslookup kubernetes.default.svc.{{ pillar['dns_domain'] }} 127.0.0.1 >/dev/null
- -port=8080
ports:
- containerPort: 8080
Expand All @@ -90,3 +113,24 @@ spec:
- name: etcd-storage
emptyDir: {}
dnsPolicy: Default # Don't use cluster DNS.
---
apiVersion: v1
kind: Service
metadata:
name: kube-dns
namespace: kube-system
labels:
k8s-app: kube-dns
kubernetes.io/cluster-service: "true"
kubernetes.io/name: "KubeDNS"
spec:
selector:
k8s-app: kube-dns
clusterIP: {{ pillar['dns_server'] }}
ports:
- name: dns
port: 53
protocol: UDP
- name: dns-tcp
port: 53
protocol: TCP

0 comments on commit 766657c

Please sign in to comment.