Merge "Add CoreDNS deployment in kubernetes atomic" into stable/newton
This commit is contained in:
commit
50e789c8db
|
@ -62,6 +62,7 @@ sed -i '
|
||||||
|
|
||||||
HOSTNAME_OVERRIDE=$(hostname --short | sed 's/\.novalocal//')
|
HOSTNAME_OVERRIDE=$(hostname --short | sed 's/\.novalocal//')
|
||||||
KUBELET_ARGS="--register-node=true --register-schedulable=false --config=/etc/kubernetes/manifests --hostname-override=${HOSTNAME_OVERRIDE}"
|
KUBELET_ARGS="--register-node=true --register-schedulable=false --config=/etc/kubernetes/manifests --hostname-override=${HOSTNAME_OVERRIDE}"
|
||||||
|
KUBELET_ARGS="${KUBELET_ARGS} --cluster_dns=${DNS_SERVICE_IP} --cluster_domain=${DNS_CLUSTER_DOMAIN}"
|
||||||
|
|
||||||
if [ -n "${INSECURE_REGISTRY_URL}" ]; then
|
if [ -n "${INSECURE_REGISTRY_URL}" ]; then
|
||||||
KUBELET_ARGS="${KUBELET_ARGS} --pod-infra-container-image=${INSECURE_REGISTRY_URL}/google_containers/pause\:0.8.0"
|
KUBELET_ARGS="${KUBELET_ARGS} --pod-infra-container-image=${INSECURE_REGISTRY_URL}/google_containers/pause\:0.8.0"
|
||||||
|
|
|
@ -28,6 +28,7 @@ sed -i '
|
||||||
# Using any other name will break the load balancer and cinder volume features.
|
# Using any other name will break the load balancer and cinder volume features.
|
||||||
HOSTNAME_OVERRIDE=$(hostname --short | sed 's/\.novalocal//')
|
HOSTNAME_OVERRIDE=$(hostname --short | sed 's/\.novalocal//')
|
||||||
KUBELET_ARGS="--config=/etc/kubernetes/manifests --cadvisor-port=4194 ${KUBE_CONFIG} --hostname-override=${HOSTNAME_OVERRIDE}"
|
KUBELET_ARGS="--config=/etc/kubernetes/manifests --cadvisor-port=4194 ${KUBE_CONFIG} --hostname-override=${HOSTNAME_OVERRIDE}"
|
||||||
|
KUBELET_ARGS="${KUBELET_ARGS} --cluster_dns=${DNS_SERVICE_IP} --cluster_domain=${DNS_CLUSTER_DOMAIN}"
|
||||||
|
|
||||||
if [ -n "$TRUST_ID" ]; then
|
if [ -n "$TRUST_ID" ]; then
|
||||||
KUBELET_ARGS="$KUBELET_ARGS --cloud-provider=openstack --cloud-config=/etc/sysconfig/kube_openstack_config"
|
KUBELET_ARGS="$KUBELET_ARGS --cloud-provider=openstack --cloud-config=/etc/sysconfig/kube_openstack_config"
|
||||||
|
|
|
@ -0,0 +1,112 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. /etc/sysconfig/heat-params
|
||||||
|
|
||||||
|
CORE_DNS=/etc/kubernetes/manifests/kube-coredns.yaml
|
||||||
|
[ -f ${CORE_DNS} ] || {
|
||||||
|
echo "Writing File: $CORE_DNS"
|
||||||
|
mkdir -p $(dirname ${CORE_DNS})
|
||||||
|
cat << EOF > ${CORE_DNS}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: coredns
|
||||||
|
namespace: kube-system
|
||||||
|
data:
|
||||||
|
Corefile: |
|
||||||
|
.:53 {
|
||||||
|
errors
|
||||||
|
log stdout
|
||||||
|
health
|
||||||
|
kubernetes ${DNS_CLUSTER_DOMAIN} {
|
||||||
|
cidrs ${PORTAL_NETWORK_CIDR}
|
||||||
|
}
|
||||||
|
proxy . /etc/resolv.conf
|
||||||
|
cache 30
|
||||||
|
}
|
||||||
|
---
|
||||||
|
apiVersion: extensions/v1beta1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: coredns
|
||||||
|
namespace: kube-system
|
||||||
|
labels:
|
||||||
|
k8s-app: coredns
|
||||||
|
kubernetes.io/cluster-service: "true"
|
||||||
|
kubernetes.io/name: "CoreDNS"
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
k8s-app: coredns
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
k8s-app: coredns
|
||||||
|
annotations:
|
||||||
|
scheduler.alpha.kubernetes.io/critical-pod: ''
|
||||||
|
scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]'
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: coredns
|
||||||
|
image: coredns/coredns:007
|
||||||
|
imagePullPolicy: Always
|
||||||
|
args: [ "-conf", "/etc/coredns/Corefile" ]
|
||||||
|
volumeMounts:
|
||||||
|
- name: config-volume
|
||||||
|
mountPath: /etc/coredns
|
||||||
|
ports:
|
||||||
|
- containerPort: 53
|
||||||
|
name: dns
|
||||||
|
protocol: UDP
|
||||||
|
- containerPort: 53
|
||||||
|
name: dns-tcp
|
||||||
|
protocol: TCP
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /health
|
||||||
|
port: 8080
|
||||||
|
scheme: HTTP
|
||||||
|
initialDelaySeconds: 60
|
||||||
|
timeoutSeconds: 5
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 5
|
||||||
|
dnsPolicy: Default
|
||||||
|
volumes:
|
||||||
|
- name: config-volume
|
||||||
|
configMap:
|
||||||
|
name: coredns
|
||||||
|
items:
|
||||||
|
- key: Corefile
|
||||||
|
path: Corefile
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: kube-dns
|
||||||
|
namespace: kube-system
|
||||||
|
labels:
|
||||||
|
k8s-app: coredns
|
||||||
|
kubernetes.io/cluster-service: "true"
|
||||||
|
kubernetes.io/name: "CoreDNS"
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
k8s-app: coredns
|
||||||
|
clusterIP: ${DNS_SERVICE_IP}
|
||||||
|
ports:
|
||||||
|
- name: dns
|
||||||
|
port: 53
|
||||||
|
protocol: UDP
|
||||||
|
- name: dns-tcp
|
||||||
|
port: 53
|
||||||
|
protocol: TCP
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Waiting for Kubernetes API..."
|
||||||
|
until curl --silent "http://127.0.0.1:8080/version"
|
||||||
|
do
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
|
||||||
|
kubectl create --validate=false -f $CORE_DNS
|
|
@ -42,3 +42,5 @@ write_files:
|
||||||
TRUST_ID="$TRUST_ID"
|
TRUST_ID="$TRUST_ID"
|
||||||
AUTH_URL="$AUTH_URL"
|
AUTH_URL="$AUTH_URL"
|
||||||
INSECURE_REGISTRY_URL="$INSECURE_REGISTRY_URL"
|
INSECURE_REGISTRY_URL="$INSECURE_REGISTRY_URL"
|
||||||
|
DNS_SERVICE_IP="$DNS_SERVICE_IP"
|
||||||
|
DNS_CLUSTER_DOMAIN="$DNS_CLUSTER_DOMAIN"
|
||||||
|
|
|
@ -41,3 +41,5 @@ write_files:
|
||||||
TRUST_ID="$TRUST_ID"
|
TRUST_ID="$TRUST_ID"
|
||||||
AUTH_URL="$AUTH_URL"
|
AUTH_URL="$AUTH_URL"
|
||||||
INSECURE_REGISTRY_URL="$INSECURE_REGISTRY_URL"
|
INSECURE_REGISTRY_URL="$INSECURE_REGISTRY_URL"
|
||||||
|
DNS_SERVICE_IP="$DNS_SERVICE_IP"
|
||||||
|
DNS_CLUSTER_DOMAIN="$DNS_CLUSTER_DOMAIN"
|
||||||
|
|
|
@ -279,6 +279,18 @@ parameters:
|
||||||
description: insecure registry url
|
description: insecure registry url
|
||||||
default: ""
|
default: ""
|
||||||
|
|
||||||
|
dns_service_ip:
|
||||||
|
type: string
|
||||||
|
description: >
|
||||||
|
address used by Kubernetes DNS service
|
||||||
|
default: 10.254.0.10
|
||||||
|
|
||||||
|
dns_cluster_domain:
|
||||||
|
type: string
|
||||||
|
description: >
|
||||||
|
domain name for cluster DNS
|
||||||
|
default: "cluster.local"
|
||||||
|
|
||||||
resources:
|
resources:
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
|
@ -517,6 +529,8 @@ resources:
|
||||||
trust_id: {get_param: trust_id}
|
trust_id: {get_param: trust_id}
|
||||||
auth_url: {get_param: auth_url}
|
auth_url: {get_param: auth_url}
|
||||||
insecure_registry_url: {get_param: insecure_registry_url}
|
insecure_registry_url: {get_param: insecure_registry_url}
|
||||||
|
dns_service_ip: {get_param: dns_service_ip}
|
||||||
|
dns_cluster_domain: {get_param: dns_cluster_domain}
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
|
@ -576,6 +590,8 @@ resources:
|
||||||
trust_id: {get_param: trust_id}
|
trust_id: {get_param: trust_id}
|
||||||
auth_url: {get_param: auth_url}
|
auth_url: {get_param: auth_url}
|
||||||
insecure_registry_url: {get_param: insecure_registry_url}
|
insecure_registry_url: {get_param: insecure_registry_url}
|
||||||
|
dns_service_ip: {get_param: dns_service_ip}
|
||||||
|
dns_cluster_domain: {get_param: dns_cluster_domain}
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
|
|
||||||
|
|
|
@ -200,6 +200,16 @@ parameters:
|
||||||
type: string
|
type: string
|
||||||
description: insecure registry url
|
description: insecure registry url
|
||||||
|
|
||||||
|
dns_service_ip:
|
||||||
|
type: string
|
||||||
|
description: >
|
||||||
|
address used by Kubernetes DNS service
|
||||||
|
|
||||||
|
dns_cluster_domain:
|
||||||
|
type: string
|
||||||
|
description: >
|
||||||
|
domain name for cluster DNS
|
||||||
|
|
||||||
resources:
|
resources:
|
||||||
|
|
||||||
master_wait_handle:
|
master_wait_handle:
|
||||||
|
@ -276,6 +286,8 @@ resources:
|
||||||
"$TRUSTEE_PASSWORD": {get_param: trustee_password}
|
"$TRUSTEE_PASSWORD": {get_param: trustee_password}
|
||||||
"$TRUST_ID": {get_param: trust_id}
|
"$TRUST_ID": {get_param: trust_id}
|
||||||
"$INSECURE_REGISTRY_URL": {get_param: insecure_registry_url}
|
"$INSECURE_REGISTRY_URL": {get_param: insecure_registry_url}
|
||||||
|
"$DNS_SERVICE_IP": {get_param: dns_service_ip}
|
||||||
|
"$DNS_CLUSTER_DOMAIN": {get_param: dns_cluster_domain}
|
||||||
|
|
||||||
make_cert:
|
make_cert:
|
||||||
type: OS::Heat::SoftwareConfig
|
type: OS::Heat::SoftwareConfig
|
||||||
|
@ -365,6 +377,12 @@ resources:
|
||||||
group: ungrouped
|
group: ungrouped
|
||||||
config: {get_file: ../../common/templates/kubernetes/fragments/enable-kube-proxy-master.sh}
|
config: {get_file: ../../common/templates/kubernetes/fragments/enable-kube-proxy-master.sh}
|
||||||
|
|
||||||
|
core_dns_service:
|
||||||
|
type: OS::Heat::SoftwareConfig
|
||||||
|
properties:
|
||||||
|
group: ungrouped
|
||||||
|
config: {get_file: ../../common/templates/kubernetes/fragments/core-dns-service.sh}
|
||||||
|
|
||||||
master_wc_notify:
|
master_wc_notify:
|
||||||
type: OS::Heat::SoftwareConfig
|
type: OS::Heat::SoftwareConfig
|
||||||
properties:
|
properties:
|
||||||
|
@ -401,6 +419,7 @@ resources:
|
||||||
- config: {get_resource: network_service}
|
- config: {get_resource: network_service}
|
||||||
- config: {get_resource: kube_system_namespace_service}
|
- config: {get_resource: kube_system_namespace_service}
|
||||||
- config: {get_resource: enable_kube_podmaster}
|
- config: {get_resource: enable_kube_podmaster}
|
||||||
|
- config: {get_resource: core_dns_service}
|
||||||
- config: {get_resource: enable_kube_proxy}
|
- config: {get_resource: enable_kube_proxy}
|
||||||
- config: {get_resource: kube_ui_service}
|
- config: {get_resource: kube_ui_service}
|
||||||
- config: {get_resource: kube_examples}
|
- config: {get_resource: kube_examples}
|
||||||
|
|
|
@ -194,6 +194,16 @@ parameters:
|
||||||
type: string
|
type: string
|
||||||
description: insecure registry url
|
description: insecure registry url
|
||||||
|
|
||||||
|
dns_service_ip:
|
||||||
|
type: string
|
||||||
|
description: >
|
||||||
|
address used by Kubernetes DNS service
|
||||||
|
|
||||||
|
dns_cluster_domain:
|
||||||
|
type: string
|
||||||
|
description: >
|
||||||
|
domain name for cluster DNS
|
||||||
|
|
||||||
resources:
|
resources:
|
||||||
|
|
||||||
minion_wait_handle:
|
minion_wait_handle:
|
||||||
|
@ -254,6 +264,8 @@ resources:
|
||||||
$TRUST_ID: {get_param: trust_id}
|
$TRUST_ID: {get_param: trust_id}
|
||||||
$AUTH_URL: {get_param: auth_url}
|
$AUTH_URL: {get_param: auth_url}
|
||||||
$INSECURE_REGISTRY_URL: {get_param: insecure_registry_url}
|
$INSECURE_REGISTRY_URL: {get_param: insecure_registry_url}
|
||||||
|
$DNS_SERVICE_IP: {get_param: dns_service_ip}
|
||||||
|
$DNS_CLUSTER_DOMAIN: {get_param: dns_cluster_domain}
|
||||||
|
|
||||||
write_kubeconfig:
|
write_kubeconfig:
|
||||||
type: OS::Heat::SoftwareConfig
|
type: OS::Heat::SoftwareConfig
|
||||||
|
|
Loading…
Reference in New Issue