add pod cidrs (#26)

This commit is contained in:
Chris O'Haver 2017-11-15 16:36:12 -05:00 committed by John Belamaric
parent 5e6be8673a
commit f40fd9b5b4
3 changed files with 9 additions and 11 deletions

View file

@ -15,21 +15,19 @@ to use the CoreDNS deployment. By re-using the existing service, there is no dis
servicing requests.
The script doesn't delete the kube-dns deployment or replication controller - you'll have to
do that manually.
do that manually, after deploying CoreDNS.
You should examine the manifest carefully and make sure it is correct for your particular
cluster. Depending on how you have built your cluster and the version you are running,
some modifications to the manifest may be needed.
In the best case scenario, all that's needed to replace Kube-DNS are these two commands:
In the best case scenario, all that's needed to replace Kube-DNS are these two commands (replacing the CIDRs with the service and pod CIDRs in your deployment respectively):
~~~
$ ./deploy.sh 10.3.0.0/24 | kubectl apply -f -
$ ./deploy.sh 10.3.0.0/12 172.17.0.0/16 | kubectl apply -f -
$ kubectl delete --namespace=kube-system deployment kube-dns
~~~
-Note that the CIDR's netmask needs to be a multiple of 8.
For non-RBAC deployments, you'll need to edit the resulting yaml before applying it:
1. Remove the line `serviceAccountName: coredns` from the `Deployment` section.
2. Remove the `ServiceAccount`, `ClusterRole`, and `ClusterRoleBinding` sections.

View file

@ -50,7 +50,7 @@ data:
errors
log stdout
health
kubernetes CLUSTER_DOMAIN SERVICE_CIDR
kubernetes CLUSTER_DOMAIN SERVICE_CIDR POD_CIDR
proxy . /etc/resolv.conf
cache 30
}

View file

@ -3,15 +3,15 @@
# Deploys CoreDNS to a cluster currently running Kube-DNS.
SERVICE_CIDR=$1
CLUSTER_DOMAIN=${2:-cluster.local}
YAML_TEMPLATE=${3:-`pwd`/coredns.yaml.sed}
YAML=${4:-`pwd`/coredns.yaml}
POD_CIDR=$2
CLUSTER_DOMAIN=${3:-cluster.local}
YAML_TEMPLATE=${4:-`pwd`/coredns.yaml.sed}
if [[ -z $SERVICE_CIDR ]]; then
echo "Usage: $0 SERVICE-CIDR [ CLUSTER-DOMAIN ] [ YAML-TEMPLATE ] [ YAML ]"
echo "Usage: $0 SERVICE-CIDR [ POD-CIDR ] [ CLUSTER-DOMAIN ] [ YAML-TEMPLATE ]"
exit 1
fi
CLUSTER_DNS_IP=$(kubectl get service --namespace kube-system kube-dns -o jsonpath="{.spec.clusterIP}")
sed -e s/CLUSTER_DNS_IP/$CLUSTER_DNS_IP/g -e s/CLUSTER_DOMAIN/$CLUSTER_DOMAIN/g -e s?SERVICE_CIDR?$SERVICE_CIDR?g $YAML_TEMPLATE
sed -e s/CLUSTER_DNS_IP/$CLUSTER_DNS_IP/g -e s/CLUSTER_DOMAIN/$CLUSTER_DOMAIN/g -e s?SERVICE_CIDR?$SERVICE_CIDR?g -e s?POD_CIDR?$POD_CIDR?g $YAML_TEMPLATE