zoukankan      html  css  js  c++  java
  • 公司内网安装dns,然后把域名ning.com直接指向ingress-nginx的ip

    configmap配置

    [root@kubeadm-master dns]# cat dnsmasq-cm.yaml 
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: dnsmasq-configmap
    data:
      dnsmasq.conf: |
        resolv-file=/etc/dnsmasq.d/resolv.dnsmasq
        addn-hosts=/etc/dnsmasq.d/dnsmasqhosts
        ## 下面一句是把ning.com指给192.168.100.110,就是ingress-server的ip
        address=/ning.com/192.168.100.110    
      dnsmasqhosts: |
        192.168.100.110 *.ning.com
      resolv.dnsmasq: |
        nameserver 114.114.114.114
        nameserver 8.8.8.8
    

    DaemonSet配置

    [root@kubeadm-master dns]# cat dnsmasq-daemonset.yaml 
    apiVersion: apps/v1
    kind: DaemonSet
    metadata:
      name: dnsmasq
      labels:
        app: dnsmasq
    spec:
      selector:
        matchLabels:
          app: dnsmasq
      template:
        metadata:
          labels:
            app: dnsmasq
        spec:
          nodeSelector:
            node-role.kubernetes.io/master: ""
          hostNetwork: true
          tolerations:
          - effect: NoSchedule
            operator: Exists
          containers:
          - name: dnsmasq
            image: andyshinn/dnsmasq:latest
            imagePullPolicy: IfNotPresent
            securityContext:
              capabilities:
                add:
                - NET_ADMIN
            readinessProbe:
              tcpSocket:
                port: 53
              initialDelaySeconds: 30
              timeoutSeconds: 1
            livenessProbe:
              tcpSocket:
                port: 53
              initialDelaySeconds: 30
              timeoutSeconds: 1
            ports:
            - containerPort: 53
              protocol: UDP
              name: dns-udp
            - containerPort: 53
              protocol: TCP
              name: dns-tcp       
            volumeMounts:
            - name: config-volume
              mountPath: /etc/dnsmasq.d/ 
          volumes:
            - name: config-volume
              configMap:
                name: dnsmasq-configmap
                items:
                - key: dnsmasqhosts
                  path: dnsmasqhosts
                - key: resolv.dnsmasq
                  path: resolv.dnsmasq
                - key: dnsmasq.conf
                  path: dnsmasq.conf
    ---
    apiVersion: v1
    kind: Service
    metadata:
      name: dnsmasq
      labels:
        app: dnsmasq
    spec:
      ports:
      - port: 53
        targetPort: 53
        protocol: TCP
        name: dns-tcp
      - port: 53
        targetPort: 53
        protocol: UDP
        name: dns-udp
      selector:
        app: dnsmasq
    
    kubectl apply -f dnsmasq-cm.yaml -n kube-system
    kubectl apply -f dnsmasq-daemonset.yaml -n kube-system
    

    将客户端的dns指向dnsmasq的ip 及完成

  • 相关阅读:
    git pull origin master命令后发生冲突
    计算属性和侦听器
    微信小程序 wx.navigateBack携带参数
    小程序----路由
    quill工具栏出现提示的功能
    quill修改字体大小
    quill报错,"RangeError: Maximum call stack size exceeded"
    quill添加字体
    新建一个vue项目(补充了vue-cli4.0快速搭建一个项目【站在巨人的肩膀上并亲测】)
    codeforce round 7
  • 原文地址:https://www.cnblogs.com/blackmood/p/11523559.html
Copyright © 2011-2022 走看看