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 ...
随机推荐
- Linux命令——screen
参考:linux 技巧:使用 screen 管理你的远程会话 How to use GNU screen - the terminal multiplexer - linux
- MySQL/MariaDB数据库的主从复制
MySQL/MariaDB数据库的主从复制 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.MySQL复制概述 1>.传统扩展方式 垂直扩展(也叫向上扩展,Sacle ...
- 利用mysql的inet_aton()和inet_ntoa()函数存储IP地址的方法
原文:https://www.jb51.net/article/29962.htm 当前很多应用都适用字符串char(15)来存储IP地址(占用16个字节),利用inet_aton()和inet_nt ...
- evpp tcp server服务端
// netserver.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include <evpp/tcp_server.h> ...
- python打造seo必备工具-自动查询排名
因为工作需要,利用业余时间开发的,可以查询百度排名+360排名工具,附上代码. #360搜索排名查询 # -*- coding=utf-8 -*- import requests from lxml ...
- MSDS 596 Homework
MSDS 596 Homework 10 Due November 28 2017Notes. The lowest grade among all eleven homework will be d ...
- js去除数组中重复的数字
var arr = [2,1,4,3,2,4,2,3,4,2,6,5,5] var obj = {}; var arrNew = []; for(var i=arr.length-1;i>=0; ...
- 走,去出海,一起“Copy to World” | 36氪出海行业报告
http://www.sohu.com/a/200845344_114778 从工具类产品在海外聚集大量流量到新闻.社交游戏等内容类产品在海外取得优异成绩,中国正在完成从Copy to China向C ...
- Vue --- 指令练习
scores = [ { name: 'Bob', math: 97, chinese: 89, english: 67 }, { name: 'Tom', math: 67, chinese: 52 ...
- tensorflow API _ 4 (优化器配置)
"""Configures the optimizer used for training. Args: learning_rate: A scalar or `Tens ...