<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                [TOC] 現在常用解析域名的方式有兩種: 1. 在dns服務器注冊一個域名, 2. 在容器的 `/etc/hosts` 上添加域名 在 `kubernetes` 上也是兩種方案,只不過第一鐘是在 `coredns` 上添加靜態解析即可。 ## coreDNS靜態解析 ### 修改coredns配置文件 ```shell $ kubectl -n kube-system edit cm coredns # 在 prometheus :9153 字段上面添加下面內容。 # fallthrough 不能省略該字段,否則不會解析其他域名 hosts { 192.168.31.188 www.ecloud.com fallthrough } ``` ### 重啟服務 ```shell $ kubectl -n kube-system delete pod -l k8s-app=kube-dns ``` ### 測試 ```shell $ kubectl run busybox --image=busybox:1.24.1 sleep 3600 pod/busybox created $ kubectl exec -it busybox -- nslookup www.ecloud.com Server: 10.183.0.254 Address 1: 10.183.0.254 kube-dns.kube-system.svc.cluster.local Name: www.ecloud.com Address 1: 192.168.31.188 www.ecloud.com ``` > 注意:需要稍等幾分鐘,再測試測試是否成功 ## hosts添加域名解析 在啟動pod的時候,添加hosts文件字段(pod.spec.hostAliases)。 1. deployment清單文件 ```yaml apiVersion: apps/v1 kind: Deployment metadata: name: busybox spec: selector: matchLabels: name: busybox template: metadata: labels: name: busybox spec: hostAliases: - hostnames: - todo.ecloud.com ip: 192.168.31.100 containers: - name: busybox image: busybox:1.24.1 imagePullPolicy: IfNotPresent command: - /bin/sh - -c - sleep 3600 ``` 2. 啟動deployment ```shell $ kubectl apply -f test.yml deployment.apps/busybox created ``` 3. 驗證 ```shell # 查看hosts文件 $ kubectl exec -it busybox-79b94f5dd8-zht64 -- cat /etc/hosts # Kubernetes-managed hosts file. 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet fe00::0 ip6-mcastprefix fe00::1 ip6-allnodes fe00::2 ip6-allrouters 20.0.32.133 busybox-79b94f5dd8-zht64 # Entries added by HostAliases. 192.168.31.100 todo.ecloud.com # ping域名 $ kubectl exec -it busybox-79b94f5dd8-zht64 -- ping -c4 todo.ecloud.com PING todo.ecloud.com (192.168.31.100): 56 data bytes 64 bytes from 192.168.31.100: seq=0 ttl=64 time=0.465 ms 64 bytes from 192.168.31.100: seq=1 ttl=64 time=0.070 ms 64 bytes from 192.168.31.100: seq=2 ttl=64 time=0.090 ms 64 bytes from 192.168.31.100: seq=3 ttl=64 time=0.080 ms --- todo.ecloud.com ping statistics --- 4 packets transmitted, 4 packets received, 0% packet loss round-trip min/avg/max = 0.070/0.176/0.465 ms ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看