首页 > 其他分享 >coredns.yaml

coredns.yaml

时间:2023-08-29 11:13:52浏览次数:35  
标签:k8s name io yaml dns coredns kube

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:
    - discovery.k8s.io
    resources:
    - endpointslices
    verbs:
    - list
    - watch
---
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 {
          lameduck 5s
        }
        ready
        kubernetes cluster.local in-addr.arpa ip6.arpa {
          fallthrough in-addr.arpa ip6.arpa
        }
        prometheus :9153
        forward . /etc/resolv.conf {
          max_concurrent 1000
        }
        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: not specified here:
  # 1. Default is 1.
  # 2. Will be tuned in real time if DNS horizontal auto-scaling is turned on.
  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:
        kubernetes.io/os: linux
      affinity:
         podAntiAffinity:
           preferredDuringSchedulingIgnoredDuringExecution:
           - weight: 100
             podAffinityTerm:
               labelSelector:
                 matchExpressions:
                   - key: k8s-app
                     operator: In
                     values: ["kube-dns"]
               topologyKey: kubernetes.io/hostname
      containers:
      - name: coredns
        image: registry.cn-beijing.aliyuncs.com/dotbalo/coredns:1.8.6 
        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.96.0.10 
  ports:
  - name: dns
    port: 53
    protocol: UDP
  - name: dns-tcp
    port: 53
    protocol: TCP
  - name: metrics
    port: 9153
    protocol: TCP

标签:k8s,name,io,yaml,dns,coredns,kube
From: https://www.cnblogs.com/chuyiwang/p/17664237.html

相关文章

  • python+selenium+pytest-(5)_yaml文件
    导包importyamlelement.yamllogin:safe:'#element'link:'#element'user:['#element','user1','user2','user3']password:['#element','pw']auth_code:'element......
  • 交互式Docker以及Yaml
    EulerOS、openEulerEulerOSLinux又为被称为华为欧拉Linux.华为欧拉系统主要针对企业级的Linux服务器操作系统,针对B端用户,一般用在企业的大型计算机上,是企业IT系统的基础架构平台进程内存管理网络容器技术编译系统、虚拟存储系统、CPU调度、IO驱动、网络和文件系统Harm......
  • yaml文件的格式解释
    什么是YAML?YAML是一种存储数据的文件格式。类似json和xml。Ansibleplaybooks或者配置文件,以称为YAML的特定格式编写。如果您使用过其他数据结构格式(如XML或JSON),则应该能够轻松地使用它。上图中就是以3种格式表示的一个server的定义简单的数据格式键值对:键和值由冒号分隔......
  • pytest+yaml测试用例
    #一、yaml格式##yaml是一种数据类型,可以和json之间灵活的切换,支持注释、换行、字符串等。可以用于配置文件或编写测试用例。##数据结构:一般是键值对的方式出现。注意编写时值前面必须有空格,键:(空格)值。##如果是数组,以-(空格)开头来表示##以user.yaml为例,这里编写两个用例,每个用......
  • yaml文件示例
     apiVersion:v1kind:Podmetadata:name:my-podspec:containers:-name:myhttpd#只要是包含子项的第一行都需要有”-“,且与上一行对齐image:httpdimagePullPolicy:IfNotPresentports:-containerPort:80-name:mynginx......
  • pytest + yaml 框架 -53.yaml 用例规范与全部关键字总结
    前言v1.4.4版本新增对yaml用例格式校验,不合法的用例格式不会被执行,避免出现用例格式不合法导致的报错。全部关键字总结config中可用关键字关键字可支持类型功能说明name可选str没什么用,仅描述当前yaml用例的名称base_url可选str,支持格式:http://、htt......
  • json和yaml语法转换
    yaml格式vim0224.yaml-"0224":老师:于超学生们:-黄彦:-年龄:23地址:深圳陈亮亮:-年龄:24地址:广州罗兴林:-年龄:24地址:贵州字典的形式:"key":"value",转化为json类型去看,{"key":value},大括号{}保存字典纯变......
  • open 一般的文件和yaml文件的区别
    一般的文件 读取的包含换行符 是数组格式#opendefget_yaml(file_path):withopen(file_path,encoding='utf-8')asfo:print(fo.readlines())if__name__=='__main__':get_yaml('../configs/evn.yaml')'''......
  • 记录一次调查OpenEuler上部署K8s,CoreDNS组件一直 CrashLoopBackOff ,describe 时 Back
    详细过程不赘述了。百度了很多办法都不可用,然后尝试重装k8s好多次也不管用。 最后解决。kubectleditdeploymentcoredns-nkube-systemapiVersion:apps/v1kind:Deploymentmetadata:annotations:deployment.kubernetes.io/revision:"2"creationTimestamp......
  • SAP Fiori Elements 应用里的 ui5.yaml 文件详解试读版
    本教程第4篇文章,我们介绍了本地启动SAPFioriElements应用的三种模式。4.SAPFioriElements本地应用启动的三种模式辨析以默认方式即命令行yarnstart启动之后,项目文件夹里的ui5.yaml文件会默认被加载并解析。ui5.yaml这个文件,在本地开发FreestyleUI5时也会......