mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-08 20:50:24 +00:00
Deferred creation of SkyDNS, monitoring and logging objects
This implements phase 1 of the proposal in #3579, moving the creation of the pods, RCs, and services to the master after the apiserver is available. This is such a wide commit because our existing initial config story is special: * Add kube-addons service and associated salt configuration: ** We configure /etc/kubernetes/addons to be a directory of objects that are appropriately configured for the current cluster. ** "/etc/init.d/kube-addons start" slurps up everything in that dir. (Most of the difficult is the business logic in salt around getting that directory built at all.) ** We cheat and overlay cluster/addons into saltbase/salt/kube-addons as config files for the kube-addons meta-service. * Change .yaml.in files to salt templates * Rename {setup,teardown}-{monitoring,logging} to {setup,teardown}-{monitoring,logging}-firewall to properly reflect their real purpose now (the purpose of these functions is now ONLY to bring up the firewall rules, and possibly to relay the IP to the user). * Rework GCE {setup,teardown}-{monitoring,logging}-firewall: Both functions were improperly configuring global rules, yet used lifecycles tied to the cluster. Use $NODE_INSTANCE_PREFIX with the rule. The logging rule needed a $NETWORK specifier. The monitoring rule tried gcloud describe first, but given the instancing, this feels like a waste of time now. * Plumb ENABLE_CLUSTER_MONITORING, ENABLE_CLUSTER_LOGGING, ELASTICSEARCH_LOGGING_REPLICAS and DNS_REPLICAS down to the master, since these are needed there now. (Desperately want just a yaml or json file we can share between providers that has all this crap. Maybe #3525 is an answer?) Huge caveats: I've gone pretty firm testing on GCE, including twiddling the env variables and making sure the objects I expect to come up, come up. I've tested that it doesn't break GKE bringup somehow. But I haven't had a chance to test the other providers.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# DNS in Kubernetes
|
||||
This directory holds an example of how to run
|
||||
[SkyDNS](https://github.com/skynetservices/skydns) in a Kubernetes cluster.
|
||||
[SkyDNS](https://github.com/skynetservices/skydns) can be configured
|
||||
to automatically run in a Kubernetes cluster.
|
||||
|
||||
## What things get DNS names?
|
||||
The only objects to which we are assigning DNS names are Services. Every
|
||||
@@ -18,23 +18,14 @@ Of course, giving services a name is just half of the problem - DNS names need a
|
||||
domain also. This implementation uses the variable `DNS_DOMAIN` (see below).
|
||||
You can configure your docker daemon with the flag `--dns-search`.
|
||||
|
||||
## How do I run it?
|
||||
The first thing you have to do is substitute the variables into the
|
||||
configuration. You can then feed the result into `kubectl`.
|
||||
## How do I configure it?
|
||||
The following environment variables are used at cluster startup to create the SkyDNS pods and configure the kubelets. If you need to, you can reconfigure your provider as necessary (e.g. `cluster/gce/config-default.sh`):
|
||||
|
||||
```shell
|
||||
DNS_SERVER_IP=10.0.0.10
|
||||
DNS_DOMAIN=kubernetes.local
|
||||
DNS_REPLICAS=2
|
||||
|
||||
sed -e "s/{DNS_DOMAIN}/$DNS_DOMAIN/g" \
|
||||
-e "s/{DNS_REPLICAS}/$DNS_REPLICAS/g" \
|
||||
./cluster/addons/dns/skydns-rc.yaml.in \
|
||||
| ./cluster/kubectl.sh create -f -
|
||||
|
||||
sed -e "s/{DNS_SERVER_IP}/$DNS_SERVER_IP/g" \
|
||||
./cluster/addons/dns/skydns-svc.yaml.in \
|
||||
| ./cluster/kubectl.sh create -f -
|
||||
ENABLE_CLUSTER_DNS=true
|
||||
DNS_SERVER_IP="10.0.0.10"
|
||||
DNS_DOMAIN="kubernetes.local"
|
||||
DNS_REPLICAS=1
|
||||
```
|
||||
|
||||
## How does it work?
|
||||
|
@@ -5,7 +5,7 @@ namespace: default
|
||||
labels:
|
||||
k8s-app: skydns
|
||||
desiredState:
|
||||
replicas: {DNS_REPLICAS}
|
||||
replicas: {{ pillar['dns_replicas'] }}
|
||||
replicaSelector:
|
||||
k8s-app: skydns
|
||||
podTemplate:
|
||||
@@ -28,7 +28,7 @@ desiredState:
|
||||
image: kubernetes/kube2sky:1.0
|
||||
command: [
|
||||
# entrypoint = "/kube2sky",
|
||||
"-domain={DNS_DOMAIN}",
|
||||
"-domain={{ pillar['dns_domain'] }}",
|
||||
]
|
||||
- name: skydns
|
||||
image: kubernetes/skydns:2014-12-23-001
|
||||
@@ -36,7 +36,7 @@ desiredState:
|
||||
# entrypoint = "/skydns",
|
||||
"-machines=http://localhost:4001",
|
||||
"-addr=0.0.0.0:53",
|
||||
"-domain={DNS_DOMAIN}.",
|
||||
"-domain={{ pillar['dns_domain'] }}.",
|
||||
]
|
||||
ports:
|
||||
- name: dns
|
||||
|
@@ -4,7 +4,7 @@ id: skydns
|
||||
namespace: default
|
||||
protocol: UDP
|
||||
port: 53
|
||||
portalIP: {DNS_SERVER_IP}
|
||||
portalIP: {{ pillar['dns_server'] }}
|
||||
containerPort: 53
|
||||
labels:
|
||||
k8s-app: skydns
|
||||
|
@@ -2,7 +2,7 @@ apiVersion: v1beta1
|
||||
kind: ReplicationController
|
||||
id: elasticsearch-logging-controller
|
||||
desiredState:
|
||||
replicas: {ELASTICSEARCH_LOGGING_REPLICAS}
|
||||
replicas: {{ pillar['elasticsearch_replicas'] }}
|
||||
replicaSelector:
|
||||
name: elasticsearch-logging
|
||||
podTemplate:
|
||||
|
Reference in New Issue
Block a user