k8s dns 带证书配置

本文涉及的产品
全局流量管理 GTM,标准版 1个月
云解析 DNS,旗舰版 1个月
公共DNS(含HTTPDNS解析),每月1000万次HTTP解析
简介: DNS部署 基于上一篇文章从零开始搭建基于calico的kubenetes,已经完成了kubernetes的部署。但未部署DNS。本章节将介绍DNS部署。 配置文件准备 skydns-rc.yaml 注意此文件与kubernetes官方提供的模板相比,在此mount了从节点的配置文件/etc/kubernetes/worker-kubeconfig.

DNS部署

基于上一篇文章从零开始搭建基于calico的kubenetes,已经完成了kubernetes的部署。但未 部署DNS。本章节将介绍DNS部署。

配置文件准备

skydns-rc.yaml 注意此文件与kubernetes官方提供的模板相比,在此mount了从节点的配置文件/etc/kubernetes/worker-kubeconfig.yaml,原因在于DNS部署有时候会出现很多未知的错误,如:10.100.0.1:443链接被拒绝、或者证书加载错误等:

# Copyright 2016 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# TODO - At some point, we need to rename all skydns-*.yaml.* files to kubedns-*.yaml.*

# Warning: This is a file generated from the base underscore template file: skydns-rc.yaml.base

apiVersion: v1
kind: ReplicationController
metadata:
 name: kube-dns-v20
 namespace: kube-system
 labels:
 k8s-app: kube-dns
 version: v20
 kubernetes.io/cluster-service: "true"
spec:
 replicas: 1
 selector:
 k8s-app: kube-dns
 version: v20
 template:
 metadata:
 labels:
 k8s-app: kube-dns
 version: v20
 annotations:
 scheduler.alpha.kubernetes.io/critical-pod: ''
 scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]'
 spec:
 containers:
 - name: kubedns
 image: shenshouer/kubedns-amd64:1.9
 resources:
 # TODO: Set memory limits when we've profiled the container for large
 # clusters, then set request = limit to keep this container in
 # guaranteed class. Currently, this container falls into the
 # "burstable" category so the kubelet doesn't backoff from restarting it.
 limits:
 memory: 170Mi
 requests:
 cpu: 100m
 memory: 70Mi
 livenessProbe:
 httpGet:
 path: /healthz-kubedns
 port: 8080
 scheme: HTTP
 initialDelaySeconds: 60
 timeoutSeconds: 5
 successThreshold: 1
 failureThreshold: 5
 readinessProbe:
 httpGet:
 path: /readiness
 port: 8081
 scheme: HTTP
 # we poll on pod startup for the Kubernetes master service and
 # only setup the /readiness HTTP server once that's available.
 initialDelaySeconds: 3
 timeoutSeconds: 5
 args:
 # command = "/kube-dns"
 - --domain=cluster.local.
 - --dns-port=10053
# - --kube-master-url=https://172.18.8.101
 - --kubecfg-file=/etc/kubernetes/worker-kubeconfig.yaml
 - --federations=myfederation=federation.test
 ports:
 - containerPort: 10053
 name: dns-local
 protocol: UDP
 - containerPort: 10053
 name: dns-tcp-local
 protocol: TCP
 volumeMounts:
 - mountPath: /etc/ssl/certs
 name: "ssl-certs"
 - mountPath: /etc/kubernetes/worker-kubeconfig.yaml
 name: "kubeconfig"
 readOnly: true
 - mountPath: /etc/kubernetes/ssl
 name: "etc-kube-ssl"
 readOnly: true

 - name: dnsmasq
 image: shenshouer/kube-dnsmasq-amd64:1.4
 livenessProbe:
 httpGet:
 path: /healthz-dnsmasq
 port: 8080
 scheme: HTTP
 initialDelaySeconds: 60
 timeoutSeconds: 5
 successThreshold: 1
 failureThreshold: 5
 args:
 - --cache-size=1000
 - --no-resolv
 - --server=127.0.0.1#10053
 - --log-facility=-
 ports:
 - containerPort: 53
 name: dns
 protocol: UDP
 - containerPort: 53
 name: dns-tcp
 protocol: TCP
 - name: healthz
 image: shenshouer/exechealthz-amd64:1.2
 resources:
 limits:
 memory: 50Mi
 requests:
 cpu: 10m
 # Note that this container shouldn't really need 50Mi of memory. The
 # limits are set higher than expected pending investigation on #29688.
 # The extra memory was stolen from the kubedns container to keep the
 # net memory requested by the pod constant.
 memory: 50Mi
 args:
 - --cmd=nslookup kubernetes.default.svc.cluster.local 127.0.0.1 >/dev/null
 - --url=/healthz-dnsmasq
 - --cmd=nslookup kubernetes.default.svc.cluster.local 127.0.0.1:10053 >/dev/null
 - --url=/healthz-kubedns
 - --port=8080
 - --quiet
 ports:
 - containerPort: 8080
 protocol: TCP
 dnsPolicy: Default # Don't use cluster DNS.
 volumes:
 - name: "ssl-certs"
 hostPath:
 path: "/usr/share/ca-certificates"
 - name: "kubeconfig"
 hostPath:
 path: "/etc/kubernetes/worker-kubeconfig.yaml"
 - name: "etc-kube-ssl"
 hostPath:
 path: "/etc/kubernetes/ssl"

skydns-svc.yaml与官方模板相同:

# Copyright 2016 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# TODO - At some point, we need to rename all skydns-*.yaml.* files to kubedns-*.yaml.*

# Warning: This is a file generated from the base underscore template file: skydns-svc.yaml.base

apiVersion: v1
kind: Service
metadata:
 name: kube-dns
 namespace: kube-system
 labels:
 k8s-app: kube-dns
 kubernetes.io/cluster-service: "true"
 kubernetes.io/name: "KubeDNS"
spec:
 selector:
 k8s-app: kube-dns
 clusterIP: 172.30.0.10
 ports:
 - name: dns
 port: 53
 protocol: UDP
 - name: dns-tcp
 port: 53
 protocol: TCP

http://blog.csdn.net/shenshouer/article/details/52946194?locationNum=2&fps=1

http://blog.csdn.net/shenshouer/article/details/53035948

https://github.com/kubernetes/kubernetes/tree/master/cluster/addons/dns

本文转自开源中国-k8s dns 带证书配置

相关实践学习
通过Ingress进行灰度发布
本场景您将运行一个简单的应用,部署一个新的应用用于新的发布,并通过Ingress能力实现灰度发布。
容器应用与集群管理
欢迎来到《容器应用与集群管理》课程,本课程是“云原生容器Clouder认证“系列中的第二阶段。课程将向您介绍与容器集群相关的概念和技术,这些概念和技术可以帮助您了解阿里云容器服务ACK/ACK Serverless的使用。同时,本课程也会向您介绍可以采取的工具、方法和可操作步骤,以帮助您了解如何基于容器服务ACK Serverless构建和管理企业级应用。 学习完本课程后,您将能够: 掌握容器集群、容器编排的基本概念 掌握Kubernetes的基础概念及核心思想 掌握阿里云容器服务ACK/ACK Serverless概念及使用方法 基于容器服务ACK Serverless搭建和管理企业级网站应用
相关文章
|
9天前
|
域名解析 存储 缓存
DNS是什么?内网电脑需要配置吗?
【10月更文挑战第22天】DNS是什么?内网电脑需要配置吗?
39 1
|
22天前
|
机器学习/深度学习 调度
mmseg配置解析 Polynomial Decay 多项式衰减
Polynomial Decay(多项式衰减)是一种常用的学习率调度方法,通过多项式函数逐步减少学习率,帮助模型更好地收敛。公式为:\[ lr = (lr_{initial} - \eta_{min}) \times \left(1 - \frac{current\_iter}{max\_iters}\right)^{power} + \eta_{min} \]。参数包括初始学习率、最小学习率、当前迭代次数、总迭代次数和衰减指数。适用于需要平滑降低学习率的场景,特别在训练后期微调模型参数。
46 0
mmseg配置解析 Polynomial Decay 多项式衰减
|
18天前
|
JSON JavaScript 前端开发
深入解析ESLint配置:从入门到精通的全方位指南,精细调优你的代码质量保障工具
深入解析ESLint配置:从入门到精通的全方位指南,精细调优你的代码质量保障工具
60 0
|
22天前
|
编解码 计算机视觉
mmseg配置解析 align_corners=False
`align_corners=False` 是图像插值操作中的一个参数,影响输入和输出图像的角点对齐方式。`align_corners=True` 严格对齐角点,而 `align_corners=False` 均匀分布像素点,更适用于保持整体比例关系的任务,如语义分割。
27 0
|
22天前
|
机器学习/深度学习 编解码
mmseg配置解析 contract_dilation=True
`contract_dilation=True` 是 ResNetV1c 中的一种设置,用于解决多层膨胀卷积中的“栅格效应”。通过调整膨胀率,使卷积核在不同阶段更密集地覆盖输入特征图,避免信息丢失,提升特征提取质量,尤其在语义分割任务中效果显著。
34 0
|
23天前
|
XML Java 数据格式
手动开发-简单的Spring基于注解配置的程序--源码解析
手动开发-简单的Spring基于注解配置的程序--源码解析
38 0
|
23天前
|
XML Java 数据格式
手动开发-简单的Spring基于XML配置的程序--源码解析
手动开发-简单的Spring基于XML配置的程序--源码解析
71 0
|
10天前
|
JSON Kubernetes 容灾
ACK One应用分发上线:高效管理多集群应用
ACK One应用分发上线,主要介绍了新能力的使用场景
|
11天前
|
Kubernetes 持续交付 开发工具
ACK One GitOps:ApplicationSet UI简化多集群GitOps应用管理
ACK One GitOps新发布了多集群应用控制台,支持管理Argo CD ApplicationSet,提升大规模应用和集群的多集群GitOps应用分发管理体验。
|
1月前
|
Kubernetes Cloud Native 云计算
云原生之旅:Kubernetes 集群的搭建与实践
【8月更文挑战第67天】在云原生技术日益成为IT行业焦点的今天,掌握Kubernetes已成为每个软件工程师必备的技能。本文将通过浅显易懂的语言和实际代码示例,引导你从零开始搭建一个Kubernetes集群,并探索其核心概念。无论你是初学者还是希望巩固知识的开发者,这篇文章都将为你打开一扇通往云原生世界的大门。
102 17

相关产品

  • 云解析DNS
  • 推荐镜像

    更多