Skip to content

Commit 16b9d5a

Browse files
committed
#lfn-cnti/certification/issues/69 helm_deploy now checks for declared helm_chart, but if not then there uses chart in helm_directory. all tests passing
1 parent 27ad206 commit 16b9d5a

29 files changed

+1285
-17
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Set up Sample CoreDNS CNF
2+
./sample-cnfs/sample-coredns-cnf/readme.md
3+
# Prerequistes
4+
### Install helm
5+
```
6+
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
7+
chmod 700 get_helm.sh
8+
./get_helm.sh
9+
```
10+
### Optional: Use a helm version manager
11+
https://github.com/yuya-takeyama/helmenv
12+
Check out helmenv into any path (here is ${HOME}/.helmenv)
13+
```
14+
${HOME}/.helmenv)
15+
$ git clone https://github.com/yuya-takeyama/helmenv.git ~/.helmenv
16+
```
17+
Add ~/.helmenv/bin to your $PATH any way you like
18+
```
19+
$ echo 'export PATH="$HOME/.helmenv/bin:$PATH"' >> ~/.bash_profile
20+
```
21+
```
22+
helmenv versions
23+
helmenv install <version 3.1?>
24+
```
25+
26+
### core-dns installation
27+
```
28+
helm install coredns stable/coredns
29+
```
30+
### Pull down the helm chart code, untar it, and put it in the cnfs/coredns directory
31+
```
32+
helm pull stable/coredns
33+
```
34+
### Example cnf-conformance config file for sample-core-dns-cnf
35+
In ./cnfs/sample-core-dns-cnf/cnf-conformance.yml
36+
```
37+
---
38+
container_names: [coredns-coredns]
39+
```
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj
22+
OWNERS
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: v1
2+
appVersion: 1.6.7
3+
description: CoreDNS is a DNS server that chains plugins and provides Kubernetes DNS
4+
Services
5+
home: https://coredns.io
6+
icon: https://coredns.io/images/CoreDNS_Colour_Horizontal.png
7+
keywords:
8+
- coredns
9+
- dns
10+
- kubedns
11+
maintainers:
12+
13+
name: Acaleph
14+
15+
name: shashidharatd
16+
17+
name: andor44
18+
19+
name: mrueg
20+
name: coredns
21+
sources:
22+
- https://github.com/coredns/coredns
23+
version: 1.10.0
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# CoreDNS
2+
3+
[CoreDNS](https://coredns.io/) is a DNS server that chains plugins and provides DNS Services
4+
5+
# TL;DR;
6+
7+
```console
8+
$ helm install --name coredns --namespace=kube-system stable/coredns
9+
```
10+
11+
## Introduction
12+
13+
This chart bootstraps a [CoreDNS](https://github.com/coredns/coredns) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. This chart will provide DNS Services and can be deployed in multiple configuration to support various scenarios listed below:
14+
15+
- CoreDNS as a cluster dns service and a drop-in replacement for Kube/SkyDNS. This is the default mode and CoreDNS is deployed as cluster-service in kube-system namespace. This mode is chosen by setting `isClusterService` to true.
16+
- CoreDNS as an external dns service. In this mode CoreDNS is deployed as any kubernetes app in user specified namespace. The CoreDNS service can be exposed outside the cluster by using using either the NodePort or LoadBalancer type of service. This mode is chosen by setting `isClusterService` to false.
17+
- CoreDNS as an external dns provider for kubernetes federation. This is a sub case of 'external dns service' which uses etcd plugin for CoreDNS backend. This deployment mode as a dependency on `etcd-operator` chart, which needs to be pre-installed.
18+
19+
## Prerequisites
20+
21+
- Kubernetes 1.10 or later
22+
23+
## Installing the Chart
24+
25+
The chart can be installed as follows:
26+
27+
```console
28+
$ helm install --name coredns --namespace=kube-system stable/coredns
29+
```
30+
31+
The command deploys CoreDNS on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists various ways to override default configuration during deployment.
32+
33+
> **Tip**: List all releases using `helm list`
34+
35+
## Uninstalling the Chart
36+
37+
To uninstall/delete the `my-release` deployment:
38+
39+
```console
40+
$ helm delete coredns
41+
```
42+
43+
The command removes all the Kubernetes components associated with the chart and deletes the release.
44+
45+
## Configuration
46+
47+
| Parameter | Description | Default |
48+
|:----------------------------------------|:--------------------------------------------------------------------------------------|:------------------------------------------------------------|
49+
| `image.repository` | The image repository to pull from | coredns/coredns |
50+
| `image.tag` | The image tag to pull from | `v1.6.7` |
51+
| `image.pullPolicy` | Image pull policy | IfNotPresent |
52+
| `replicaCount` | Number of replicas | 1 |
53+
| `resources.limits.cpu` | Container maximum CPU | `100m` |
54+
| `resources.limits.memory` | Container maximum memory | `128Mi` |
55+
| `resources.requests.cpu` | Container requested CPU | `100m` |
56+
| `resources.requests.memory` | Container requested memory | `128Mi` |
57+
| `serviceType` | Kubernetes Service type | `ClusterIP` |
58+
| `prometheus.monitor.enabled` | Set this to `true` to create ServiceMonitor for Prometheus operator | `false` |
59+
| `prometheus.monitor.additionalLabels` | Additional labels that can be used so ServiceMonitor will be discovered by Prometheus | {} |
60+
| `prometheus.monitor.namespace` | Selector to select which namespaces the Endpoints objects are discovered from. | `""` |
61+
| `service.clusterIP` | IP address to assign to service | `""` |
62+
| `service.loadBalancerIP` | IP address to assign to load balancer (if supported) | `""` |
63+
| `service.externalTrafficPolicy` | Enable client source IP preservation | `[]` |
64+
| `service.annotations` | Annotations to add to service | `{prometheus.io/scrape: "true", prometheus.io/port: "9153"}`|
65+
| `serviceAccount.create` | If true, create & use serviceAccount | false |
66+
| `serviceAccount.name` | If not set & create is true, use template fullname | |
67+
| `rbac.create` | If true, create & use RBAC resources | true |
68+
| `rbac.pspEnable` | Specifies whether a PodSecurityPolicy should be created. | `false` |
69+
| `isClusterService` | Specifies whether chart should be deployed as cluster-service or normal k8s app. | true |
70+
| `priorityClassName` | Name of Priority Class to assign pods | `""` |
71+
| `servers` | Configuration for CoreDNS and plugins | See values.yml |
72+
| `affinity` | Affinity settings for pod assignment | {} |
73+
| `nodeSelector` | Node labels for pod assignment | {} |
74+
| `tolerations` | Tolerations for pod assignment | [] |
75+
| `zoneFiles` | Configure custom Zone files | [] |
76+
| `extraSecrets` | Optional array of secrets to mount inside the CoreDNS container | [] |
77+
| `customLabels` | Optional labels for Deployment(s), Pod, Service, ServiceMonitor objects | {} |
78+
| `podDisruptionBudget` | Optional PodDisruptionBudget | {} |
79+
| `autoscaler.enabled` | Optionally enabled a cluster-proportional-autoscaler for CoreDNS | `false` |
80+
| `autoscaler.coresPerReplica` | Number of cores in the cluster per CoreDNS replica | `256` |
81+
| `autoscaler.nodesPerReplica` | Number of nodes in the cluster per CoreDNS replica | `16` |
82+
| `autoscaler.image.repository` | The image repository to pull autoscaler from | k8s.gcr.io/cluster-proportional-autoscaler-amd64 |
83+
| `autoscaler.image.tag` | The image tag to pull autoscaler from | `1.7.1` |
84+
| `autoscaler.image.pullPolicy` | Image pull policy for the autoscaler | IfNotPresent |
85+
| `autoscaler.priorityClassName` | Optional priority class for the autoscaler pod. `priorityClassName` used if not set. | `""` |
86+
| `autoscaler.affinity` | Affinity settings for pod assignment for autoscaler | {} |
87+
| `autoscaler.nodeSelector` | Node labels for pod assignment for autoscaler | {} |
88+
| `autoscaler.tolerations` | Tolerations for pod assignment for autoscaler | [] |
89+
| `autoscaler.resources.limits.cpu` | Container maximum CPU for cluster-proportional-autoscaler | `20m` |
90+
| `autoscaler.resources.limits.memory` | Container maximum memory for cluster-proportional-autoscaler | `10Mi` |
91+
| `autoscaler.resources.requests.cpu` | Container requested CPU for cluster-proportional-autoscaler | `20m` |
92+
| `autoscaler.resources.requests.memory` | Container requested memory for cluster-proportional-autoscaler | `10Mi` |
93+
| `autoscaler.configmap.annotations` | Annotations to add to autoscaler config map. For example to stop CI renaming them | {} |
94+
95+
See `values.yaml` for configuration notes. Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
96+
97+
```console
98+
$ helm install --name coredns \
99+
--set rbac.create=false \
100+
stable/coredns
101+
```
102+
103+
The above command disables automatic creation of RBAC rules.
104+
105+
Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example,
106+
107+
```console
108+
$ helm install --name coredns -f values.yaml stable/coredns
109+
```
110+
111+
> **Tip**: You can use the default [values.yaml](values.yaml)
112+
113+
114+
## Caveats
115+
116+
The chart will automatically determine which protocols to listen on based on
117+
the protocols you define in your zones. This means that you could potentially
118+
use both "TCP" and "UDP" on a single port.
119+
Some cloud environments like "GCE" or "Azure container service" cannot
120+
create external loadbalancers with both "TCP" and "UDP" protocols. So
121+
When deploying CoreDNS with `serviceType="LoadBalancer"` on such cloud
122+
environments, make sure you do not attempt to use both protocols at the same
123+
time.
124+
125+
## Autoscaling
126+
127+
By setting `autoscaler.enabled = true` a
128+
[cluster-proportional-autoscaler](https://github.com/kubernetes-incubator/cluster-proportional-autoscaler)
129+
will be deployed. This will default to a coredns replica for every 256 cores, or
130+
16 nodes in the cluster. These can be changed with `autoscaler.coresPerReplica`
131+
and `autoscaler.nodesPerReplica`. When cluster is using large nodes (with more
132+
cores), `coresPerReplica` should dominate. If using small nodes,
133+
`nodesPerReplica` should dominate.
134+
135+
This also creates a ServiceAccount, ClusterRole, and ClusterRoleBinding for
136+
the autoscaler deployment.
137+
138+
`replicaCount` is ignored if this is enabled.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{{- if .Values.isClusterService }}
2+
CoreDNS is now running in the cluster as a cluster-service.
3+
{{- else }}
4+
CoreDNS is now running in the cluster.
5+
It can be accessed using the below endpoint
6+
{{- if contains "NodePort" .Values.serviceType }}
7+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "coredns.fullname" . }})
8+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
9+
echo "$NODE_IP:$NODE_PORT"
10+
{{- else if contains "LoadBalancer" .Values.serviceType }}
11+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
12+
You can watch the status by running 'kubectl get svc -w {{ template "coredns.fullname" . }}'
13+
14+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "coredns.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
15+
echo $SERVICE_IP
16+
{{- else if contains "ClusterIP" .Values.serviceType }}
17+
"{{ template "coredns.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local"
18+
from within the cluster
19+
{{- end }}
20+
{{- end }}
21+
22+
It can be tested with the following:
23+
24+
1. Launch a Pod with DNS tools:
25+
26+
kubectl run -it --rm --restart=Never --image=infoblox/dnstools:latest dnstools
27+
28+
2. Query the DNS server:
29+
30+
/ # host kubernetes

0 commit comments

Comments
 (0)