k8s记录-kube-dns(core-dns)配置(七)
docker search coredns
docker pull xxx 拉取镜像(根据实际情况选择)
docker tag xxx coredns/coredns:latest
docker tag coredns/coredns:latest 192.168.0.1:5000/coredns/coredns:latest
docker push 192.168.0.1:5000/coredns/coredns:latest
kubectl create –f coredns.yaml
kubectl get pods -A
kubectl get svc -A
coredns.yaml:修改image: coredns/coredns:latest 和clusterIP: 10.1.0.2
apiVersion: v1
kind: ServiceAccount
metadata:
name: coredns
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
kubernetes.io/bootstrapping: rbac-defaults
name: system:coredns
rules:
- apiGroups:
- ""
resources:
- endpoints
- services
- pods
- namespaces
verbs:
- list
- watch
- apiGroups:
- ""
resources:
- nodes
verbs:
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
annotations:
rbac.authorization.kubernetes.io/autoupdate: "true"
labels:
kubernetes.io/bootstrapping: rbac-defaults
name: system:coredns
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:coredns
subjects:
- kind: ServiceAccount
name: coredns
namespace: kube-system
---
apiVersion: v1
kind: ConfigMap
metadata:
name: coredns
namespace: kube-system
data:
Corefile: |
.:53 {
errors
health
ready
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
fallthrough in-addr.arpa ip6.arpa
}
prometheus :9153
forward . /etc/resolv.conf
cache 30
loop
reload
loadbalance
}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: coredns
namespace: kube-system
labels:
k8s-app: kube-dns
kubernetes.io/name: "CoreDNS"
spec:
replicas: 2
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
selector:
matchLabels:
k8s-app: kube-dns
template:
metadata:
labels:
k8s-app: kube-dns
spec:
priorityClassName: system-cluster-critical
serviceAccountName: coredns
tolerations:
- key: "CriticalAddonsOnly"
operator: "Exists"
nodeSelector:
beta.kubernetes.io/os: linux
containers:
- name: coredns
image: coredns/coredns:1.6.2
imagePullPolicy: IfNotPresent
resources:
limits:
memory: 170Mi
requests:
cpu: 100m
memory: 70Mi
args: [ "-conf", "/etc/coredns/Corefile" ]
volumeMounts:
- name: config-volume
mountPath: /etc/coredns
readOnly: true
ports:
- containerPort: 53
name: dns
protocol: UDP
- containerPort: 53
name: dns-tcp
protocol: TCP
- containerPort: 9153
name: metrics
protocol: TCP
securityContext:
allowPrivilegeEscalation: false
capabilities:
add:
- NET_BIND_SERVICE
drop:
- all
readOnlyRootFilesystem: true
livenessProbe:
httpGet:
path: /health
port: 8080
scheme: HTTP
initialDelaySeconds: 60
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 5
readinessProbe:
httpGet:
path: /ready
port: 8181
scheme: HTTP
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
annotations:
prometheus.io/port: "9153"
prometheus.io/scrape: "true"
labels:
k8s-app: kube-dns
kubernetes.io/cluster-service: "true"
kubernetes.io/name: "CoreDNS"
spec:
selector:
k8s-app: kube-dns
clusterIP: 10.1.0.2
ports:
- name: dns
port: 53
protocol: UDP
- name: dns-tcp
port: 53
protocol: TCP
- name: metrics
port: 9153
protocol: TCP
############################################
#!/bin/bash
kubectl create -f coredns.yaml
kubectl create -f busybox.yaml
kubectl get all -A
kubectl exec busybox -- cat /etc/resolv.conf
kubectl exec -ti busybox -- nslookup kubernetes.default apiVersion: v1
kind: Pod
metadata:
name: busybox
namespace: default
spec:
containers:
- name: busybox
image: busybox:1.28
command:
- sleep
- "3600"
imagePullPolicy: IfNotPresent
restartPolicy: Always apiVersion: v1
kind: Endpoints
metadata:
name: proxy-ext
namespace: xxx
subsets:
- addresses:
- ip: xxx
ports:
- port: xxx
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
name: xxx
namespace: xxx
spec:
ports:
- port: xxx
targetPort: xxx
protocol: TCP
k8s记录-kube-dns(core-dns)配置(七)的更多相关文章
- Ubuntu 12.04 DNS服务器的配置方法
Bind是一款开放源码的DNS服务器软件,由美国加州大学Berkeley分校开发和维护的,全名为Berkeley Internet Name Domain它是目前世界上使用最为广泛的DNS服务器软件, ...
- Windows Server 2008 DNS服务器安装与配置
Windows Server 2008 DNS服务器安装与配置本文关键字:Windows Server 2008 DNS.IIS 服务器安装与配置,DNS服务器本文来源:http://www.ip-t ...
- linux下ifconfig, DNS以及route配置
转载:http://blog.csdn.net/wangjingfei/article/details/5283632/ 熟悉使用ifconfig 会非常方便. ifconfig eth0 新ip 然 ...
- 001.DNS原理及配置格式
一 dns简介 DNS(Domain Name System,域名系统),因特网上作为域名和IP地址相互映射的一个分布式数据库,能够使用户更方便的访问互联网,而不用去记住能够被机器直接读取的IP数串. ...
- DNS Bind服务配置解析
DNS域名解析服务(Domain Name System)是用于解析域名与IP地址对应关系的服务,功能上可以实现正向解析与反向解析: 一.DNS服务器工作模式分类: 1.主服务器:在特定区域内具有唯一 ...
- DNS和Bind配置指南
/////////////////////////////目录//////////////////////////////////////一.DNS原理相关二.使用bind搭建最简单的DNS服务器三. ...
- Linux:DNS主、从、缓存服务器配置、DNS同步加密TSIG配置、DNS分离解析配置
DNS主服务器配置(正向解析.反向解析) 正向解析:根据主机名查找对应的IP地址.当用户访问一个域名时(不考虑hosts文件等因素),正常情况会向指定的DNS主机发送递归查询请求反向解析:根据IP地址 ...
- DNS原理与配置
DNS介绍 域名管理系统DNS(Domain Name System)是域名解析服务器的意思,应用层协议,是互联网的一项服务. DNS作用是: 把域名转换成网络可以识别的ip地址,在通过IP地址访问主 ...
- Linux之临时配置网络(ip,网关,dns)+永久配置
作业一:临时配置网络(ip,网关,dns)+永久配置 配置网络信息 [root@localhost ~]# ifconfig eno16777736: flags=4163<UP,BROADCA ...
随机推荐
- PHP开启慢日志查询
1.找到php-fpm.conf文件 2.去掉request_slowlog_timeout前面的分号,并设置时间.如:request_slowlog_timeout=5表示超过5秒的 慢日志文件位置 ...
- C++(四十五) — 类型转换(static_cast、dynamic_cast 、const_cast、reinterpreter_cast)
0.总结 (1)要转换的变量,转换前.转换后.转换后的结果. (2)一般情况下,避免进行类型转换. 1._static_cast(静态类型转换,int 转换为char) 格式:TYPE B = st ...
- Jenkins持续集成邮件发送
jenkins下载:https://jenkins.io/downloadgeneric java package(war) 1.tomcat部署: 0.jdk环境 1.修改conf目录下的serve ...
- 如果在使用谷歌的gson的时候,在返回时间类型的数据的时候,
可能会出现在long类型的时间后面多3个0 如下图所示 可以自己创建一个json序列化的类 public class Date2LongSerializer extends JsonSerialize ...
- 分析和研究Monkey Log文件
Log 在Android中的地位非常重要,要是作为一个android程序员不能过分析log这关,算是android没有入门吧 . 下面我们就来说说如何处理log文件 . 什么时候会有Log文件的产生 ...
- easyui_验证扩展
本文为转载,并非原创 easyui validatebox 验证类型 分类: jquery-easyUI -- : 11000人阅读 评论() 收藏 举报 easyuiValidateBox requ ...
- T-sql 遍历结果集
DECLARE @TAB TABLE( [科室编号] [varchar](50) NULL, [科室编码] [varchar](50) NULL, [科室名称] [varchar](50) NULL, ...
- MSc in Robotics
MSc in RoboticsProgramming Methods for Robotics AssignmentIrene Moulitsas & Peter SherarCranfiel ...
- 5、Python之包管理工具pip
pip提供我们各色各样的软件(第三方库),而这些第三方库又可以给我们实现各种各样不同的功能,科学计算.画图.操作文件.聊天-- 我们可以通过Cmd终端.Pycharm.Jupyter三种平台使用pip ...
- circus security 来自官方的安全建议
转自:https://circus.readthedocs.io/en/latest/design/security/ Circus is built on the top of the ZeroMQ ...