Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deploy the coredns plug-in in kubernetes

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

In this issue, the editor will bring you about how to deploy coredns plug-ins in kubernetes. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

One: brief introduction

Starting with Kubernetes 1.10, switch the default DNS service to CoreDNS (beta test phase) during installation. Here is the deployment of the coredns plug-in in the Kubernetes 1.10.4 cluster.

Two: installation

Extract the downloaded kubernetes-server-linux-amd64.tar.gz, and then extract the kubernetes-src.tar.gz file in it. The directory corresponding to coredns is: cluster/addons/dns.

Yaml file configuration: cp kubernetes1.10.4/kubernetes/cluster/addons/dns/coredns.yaml.base coredns.yaml

$diff coredns.yaml.base coredns.yaml61c61

< kubernetes __PILLAR__DNS__DOMAIN__ in-addr.arpa ip6.arpa {--->

Kubernetes cluster.local. In-addr.arpa ip6.arpa {153c153

< clusterIP: __PILLAR__DNS__SERVER__--->

ClusterIP: 10.254.0.The _ _ MACHINE_GENERATED_WARNING__apiVersion: v1kind: ServiceAccountmetadata: name: coredns namespace: kube-system labels: kubernetes.io/cluster-service: "true" addonmanager.kubernetes.io/mode: Reconcile---apiVersion: rbac.authorization.k8s.io/v1kind: ClusterRolemetadata: labels: kubernetes.io/bootstrapping: rbac-defaults addonmanager.kubernetes.io/mode: Reconcile name: system:corednsrules:- apiGroups:-"" Resources:-endpoints services-pods-namespaces verbs:-list-watch---apiVersion: rbac.authorization.k8s.io/v1kind: ClusterRoleBindingmetadata: annotations: rbac.authorization.kubernetes.io/autoupdate: "true" labels: kubernetes.io/bootstrapping: rbac-defaults addonmanager.kubernetes.io/mode: EnsureExists name: system:corednsroleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: system:corednssubjects:- kind: ServiceAccount name: coredns namespace: kube-system- -- apiVersion: v1kind: ConfigMapmetadata: name: coredns namespace: kube-system labels: addonmanager.kubernetes.io/mode: EnsureExistsdata: Corefile: |.: 53 {errors health kubernetes cluster.local. In-addr.arpa ip6.arpa {pods insecure upstream fallthrough in-addr.arpa ip6.arpa} prometheus: 9153 proxy. / etc/resolv.conf cache 30}-apiVersion: extensions/v1beta1kind: Deploymentmetadata: name: coredns namespace: kube-system labels: k8s-app: coredns kubernetes.io/cluster-service: "true" addonmanager.kubernetes.io/mode: Reconcile kubernetes.io/name: "CoreDNS" spec: replicas: 2 strategy: type: RollingUpdate rollingUpdate: maxUnavailable: 1 selector: matchLabels: k8s-app: coredns template: metadata: Labels: k8s-app: coredns spec: serviceAccountName: coredns tolerations:-key: node-role.kubernetes.io/master effect: NoSchedule-key: "CriticalAddonsOnly" operator: "Exists" containers:-name: coredns image: coredns/coredns:1.0.6 imagePullPolicy: IfNotPresent resources: limits: Memory: 170Mi requests: cpu: 100m memory: 70Mi args: ["- conf" VolumeMounts:-name: config-volume mountPath: / etc/coredns ports:-containerPort: 53 name: dns protocol: UDP-containerPort: 53 name: dns-tcp protocol: TCP livenessProbe: httpGet: path: / health port: 8080 Scheme: HTTP initialDelaySeconds: 60 timeoutSeconds: 5 successThreshold: 1 failureThreshold: 5 dnsPolicy: Default volumes:-name: config-volume configMap: name: coredns items:-key: Corefile path: Corefile---apiVersion: v1kind: Servicemetadata: name: coredns namespace: kube-system labels: K8s- App: coredns kubernetes.io/cluster-service: "true" addonmanager.kubernetes.io/mode: Reconcile kubernetes.io/name: "CoreDNS" spec: selector: k8s-app: coredns clusterIP: 10.254.0.2 ports:-name: dns port: 53 protocol: UDP-name: dns-tcp port: 53 protocol: TCPkubectl create-f coredns.yaml

Three: testing

Create a simple busybox pod busybox.yaml

ApiVersion: v1kind: Podmetadata: name: busybox namespace: defaultspec: containers:-image: busybox command:-sleep-"3600" imagePullPolicy: IfNotPresent name: busybox restartPolicy: Always

Create POD

Kubectl CREATE-f busybox.yaml

Verification

Kubectl exec-ti busybox-- nslookup kubernetes.default

Server: 10.0.0.10Address 1: 10.0.0.10Name: kubernetes.defaultAddress 1: 10.0.0.1 the above is how to deploy the coredns plug-in in kubernetes shared by the editor. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report