k8s dns 带证书配置

简介: 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 带证书配置

相关实践学习
容器服务Serverless版ACK Serverless 快速入门:在线魔方应用部署和监控
通过本实验,您将了解到容器服务Serverless版ACK Serverless 的基本产品能力,即可以实现快速部署一个在线魔方应用,并借助阿里云容器服务成熟的产品生态,实现在线应用的企业级监控,提升应用稳定性。
云原生实践公开课
课程大纲 开篇:如何学习并实践云原生技术 基础篇: 5 步上手 Kubernetes 进阶篇:生产环境下的 K8s 实践 相关的阿里云产品:容器服务 ACK 容器服务 Kubernetes 版(简称 ACK)提供高性能可伸缩的容器应用管理能力,支持企业级容器化应用的全生命周期管理。整合阿里云虚拟化、存储、网络和安全能力,打造云端最佳容器化应用运行环境。 了解产品详情: https://www.aliyun.com/product/kubernetes
相关文章
|
6天前
|
数据采集 消息中间件 监控
Flume数据采集系统设计与配置实战:面试经验与必备知识点解析
【4月更文挑战第9天】本文深入探讨Apache Flume的数据采集系统设计,涵盖Flume Agent、Source、Channel、Sink的核心概念及其配置实战。通过实例展示了文件日志收集、网络数据接收、命令行实时数据捕获等场景。此外,还讨论了Flume与同类工具的对比、实际项目挑战及解决方案,以及未来发展趋势。提供配置示例帮助理解Flume在数据集成、日志收集中的应用,为面试准备提供扎实的理论与实践支持。
21 1
|
27天前
|
缓存 网络协议 Linux
【Shell 命令集合 网络通讯 】Linux 配置DNS dnsconf 命令 使用教程
【Shell 命令集合 网络通讯 】Linux 配置DNS dnsconf 命令 使用教程
38 0
|
28天前
|
缓存 Kubernetes Docker
容器服务ACK常见问题之容器服务ACK ingress websocket配置失败如何解决
容器服务ACK(阿里云容器服务 Kubernetes 版)是阿里云提供的一种托管式Kubernetes服务,帮助用户轻松使用Kubernetes进行应用部署、管理和扩展。本汇总收集了容器服务ACK使用中的常见问题及答案,包括集群管理、应用部署、服务访问、网络配置、存储使用、安全保障等方面,旨在帮助用户快速解决使用过程中遇到的难题,提升容器管理和运维效率。
|
1月前
|
网络协议 Linux
Linux DNS服务详解——DNS主从架构配置
Linux DNS服务详解——DNS主从架构配置
405 4
|
2月前
|
存储 运维 Kubernetes
批处理及有状态等应用类型在 K8S 上应该如何配置?
批处理及有状态等应用类型在 K8S 上应该如何配置?
|
2月前
|
域名解析 应用服务中间件 Linux
【服务器】使用域名解析服务器的IP地址并配置SSL证书
【服务器】使用域名解析服务器的IP地址并配置SSL证书
403 0
|
3月前
|
算法 C++ 容器
C++ STL:空间配置器源码解析
C++ STL:空间配置器源码解析
|
20天前
|
网络协议 Linux 网络安全
Linux服务器DNS服务器配置实现bind的正向解释和反向解释
Linux服务器DNS服务器配置实现bind的正向解释和反向解释
17 0
|
1月前
|
消息中间件 运维 监控
|
2月前
|
域名解析 网络协议 应用服务中间件
云解析DNS问题之配置域名解析ip地址如何解决
DNS解析是指将人类可读的域名转换成机器可读的IP地址的过程,它是互联网访问中不可或缺的一环;本合集将介绍DNS解析的机制、类型和相关问题的解决策略,以确保域名解析的准确性和高效性。
45 1

相关产品

  • 云解析DNS
  • 推荐镜像

    更多