mirror of https://github.com/k3s-io/k3s
support dns in particular
parent
374658ef01
commit
7b8ed5a12c
|
@ -33,9 +33,10 @@
|
|||
- hosts: masters
|
||||
sudo: yes
|
||||
roles:
|
||||
- kubernetes-addons
|
||||
- kubernetes-addons
|
||||
tags:
|
||||
- addons
|
||||
- addons
|
||||
- dns
|
||||
|
||||
# install kubernetes on the nodes
|
||||
- hosts: nodes
|
||||
|
|
|
@ -42,3 +42,22 @@ flannel_prefix: 12
|
|||
# will give to each node on your network. With these defaults you should have
|
||||
# room for 4096 nodes with 254 pods per node.
|
||||
flannel_host_prefix: 24
|
||||
|
||||
# Turn this varable to 'false' to disable whole DNS configuration.
|
||||
dns_setup: true
|
||||
# How many replicas in the Replication Controller
|
||||
dns_replicas: 1
|
||||
|
||||
# Internal DNS domain name.
|
||||
# This domain must not be used in your network. Services will be discoverable
|
||||
# under <service-name>.<namespace>.<domainname>, e.g.
|
||||
# myservice.default.kube.local
|
||||
dns_domain: kube.local
|
||||
|
||||
# IP address of the DNS server.
|
||||
# Kubernetes will create a pod with several containers, serving as the DNS
|
||||
# server and expose it under this IP address. The IP address must be from
|
||||
# the range specified as kube_service_addresses above.
|
||||
# And this is the IP address you should use as address of the DNS server
|
||||
# in your containers.
|
||||
dns_server: 10.254.0.10
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
---
|
||||
- name: DNS | Assures {{ kube_config_dir }}/addons/dns dir exists
|
||||
file: path={{ kube_config_dir }}/addons/dns state=directory
|
||||
|
||||
- name: DNS | Assures local dns addon dir exists
|
||||
local_action: file
|
||||
path={{ local_temp_addon_dir }}/dns
|
||||
state=directory
|
||||
sudo: no
|
||||
|
||||
- name: DNS | Download skydns-rc.yaml file from Kubernetes repo
|
||||
local_action: get_url
|
||||
url=https://raw.githubusercontent.com/GoogleCloudPlatform/kubernetes/master/cluster/addons/dns/skydns-rc.yaml.in
|
||||
dest="{{ local_temp_addon_dir }}/dns/skydns-rc.yaml.j2"
|
||||
force=yes
|
||||
sudo: no
|
||||
|
||||
- name: DNS | Convert pillar vars to ansible vars for skydns-rc.yaml
|
||||
local_action: replace
|
||||
dest="{{ local_temp_addon_dir }}/dns/skydns-rc.yaml.j2"
|
||||
regexp="pillar\[\'(\w*)\'\]"
|
||||
replace="\1"
|
||||
sudo: no
|
||||
|
||||
- name: DNS | Install Template from converted saltfile
|
||||
template:
|
||||
args:
|
||||
src: "{{ local_temp_addon_dir }}/dns/skydns-rc.yaml.j2"
|
||||
dest: "{{ kube_config_dir }}/addons/dns/skydns-rc.yaml"
|
||||
mode: 0755
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
- name: DNS | Download skydns-svc.yaml file from Kubernetes repo
|
||||
local_action: get_url
|
||||
url=https://raw.githubusercontent.com/GoogleCloudPlatform/kubernetes/master/cluster/addons/dns/skydns-svc.yaml.in
|
||||
dest="{{ local_temp_addon_dir }}/dns/skydns-svc.yaml.j2"
|
||||
force=yes
|
||||
sudo: no
|
||||
|
||||
- name: DNS | Convert pillar vars to ansible vars for skydns-rc.yaml
|
||||
local_action: replace
|
||||
dest="{{ local_temp_addon_dir }}/dns/skydns-svc.yaml.j2"
|
||||
regexp="pillar\[\'(\w*)\'\]"
|
||||
replace="\1"
|
||||
sudo: no
|
||||
|
||||
- name: DNS | Install Template from converted saltfile
|
||||
template:
|
||||
args:
|
||||
src: "{{ local_temp_addon_dir }}/dns/skydns-svc.yaml.j2"
|
||||
dest: "{{ kube_config_dir }}/addons/dns/skydns-svc.yaml"
|
||||
mode: 0755
|
||||
owner: root
|
||||
group: root
|
|
@ -11,6 +11,10 @@
|
|||
state=directory
|
||||
sudo: no
|
||||
|
||||
- include: dns.yml
|
||||
when: dns_setup
|
||||
tags: dns
|
||||
|
||||
#- name: Get kube-addons script from Kubernetes
|
||||
# get_url:
|
||||
# url=https://raw.githubusercontent.com/GoogleCloudPlatform/kubernetes/master/cluster/saltbase/salt/kube-addons/kube-addons.sh
|
||||
|
@ -37,7 +41,7 @@
|
|||
environment:
|
||||
TOKEN_DIR: "{{ kube_config_dir }}"
|
||||
with_items:
|
||||
-
|
||||
- "system:dns"
|
||||
register: gentoken
|
||||
changed_when: "'Added' in gentoken.stdout"
|
||||
notify:
|
||||
|
|
|
@ -14,4 +14,8 @@ KUBELET_HOSTNAME="--hostname_override={{ inventory_hostname }}"
|
|||
KUBELET_API_SERVER="--api_servers=https://{{ groups['masters'][0]}}:443"
|
||||
|
||||
# Add your own!
|
||||
{% if dns_setup %}
|
||||
KUBELET_ARGS="--cluster_dns={{ dns_server }} --cluster_domain={{ dns_domain }} --kubeconfig={{ kube_config_dir}}/kubelet.kubeconfig"
|
||||
{% else %}
|
||||
KUBELET_ARGS="--kubeconfig={{ kube_config_dir}}/kubelet.kubeconfig"
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in New Issue