Kubernetes Dashboard and DNS deployment

Source: Internet
Author: User
Tags k8s kubernetes dashboard

The previous blog post describes the deployment of the K8s cluster, which focuses on deploying Kube-dns and dashboard.

Environment description

Node-1 (Master): 10.0.0.1
Node-2:10.0.0.2
Node-3:10.0.0.3

The cluster uses a binary installation, and the Flannel network plug-in is deployed.

Kube-dns

When doing the following, you must have already deployed the k8s cluster, if you do not have such a cluster, please refer to my previous blog post.

1, find the corresponding Yaml file on the official website, the address is: https://github.com/kubernetes/kubernetes/tree/2f011d01fa542633184cde4bba97d006b8d06309/ Cluster/addons/dns/coredns, we modify the relevant configuration, mainly the configuration information of Clusterip and the Mirror path:

ApiVersion:v1kind:ServiceAccountmetadata:name:coredns Namespace:kube-system Labels:kubernetes.io/cluster-ser Vice: "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 N ame:system:corednssubjects:-kind:serviceaccount name:coredns Namespace:kube-system---apiVersion:v1kind:ConfigMap  Metadata:name:coredns Namespace:kube-system Labels:    Addonmanager.kubernetes.io/mode:ensureexistsdata:corefile: |            .: 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---apiversion:extensions/v1beta1kind:deploymentmetadata:name:coredns namespace: Kube-system Labels:k8s-app:coredns Kubernetes.io/cluster-service: "True" Addonmanager.kubernetes.io/mode:rec Oncile kubernetes.io/name: "Coredns" Spec:replicas:2 strategy:type:RollingUpdate Rollingupdate:maxunav    Ailable:1 Selector:matchlabels:k8s-app:coredns Template:metadata:labels:k8s-app:coredns Spec:serviceAccountName:coredns tolerations:-Key:node-role.kubernetes.io/master effect:n Oschedule-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", "        /etc/coredns/corefile "] 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 Sche Me:http initialdelayseconds:60 timeoutseconds:5 successthreshold:1 Failurethreshol            D: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 Kub    Ernetes.io/name: "Coredns" Spec:selector:k8s-app:coredns clusterip:10.222.0.100 Ports:-Name:dns port:53 Protocol:udp-name:dns-tcp port:53 protocol:tcp

Execute this YAML file:

kubectl  create -f coredns.yaml

To view file status:

[[email protected] ~]# kubectl get pods -n kube-systemNAME                                    READY     STATUS    RESTARTS   AGEcoredns-77c989547b-2rg9h                1/1       Running   0          1hcoredns-77c989547b-cbj5h                1/1       Running   0          1h[[email protected] ~]# kubectl get rs -n kube-systemNAME                              DESIRED   CURRENT   READY     AGEcoredns-77c989547b                2         2         2         1h[[email protected] ~]# kubectl get svc -n kube-systemNAME                   TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)         AGEcoredns                ClusterIP   10.222.0.100     <none>        53/UDP,53/TCP   1h
Configure Dashboard

To download the official Yaml file, execute the following command:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml

You will not be able to find the dashboard service unless you have the DNS services installed to use dashboard.

When the dashboard service starts, check to see if the service is working:

[[email protected] ~]# kubectl get pod -n kube-systemNAME                                    READY     STATUS    RESTARTS   AGEcoredns-77c989547b-2rg9h                1/1       Running   0          2hcoredns-77c989547b-cbj5h                1/1       Running   0          2hkubernetes-dashboard-7d5dcdb6d9-h66fs   1/1       Running   0          1h[[email protected] ~]# kubectl get svc -n kube-systemNAME                   TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)         AGEcoredns                ClusterIP   10.222.0.100     <none>        53/UDP,53/TCP   2hkubernetes-dashboard   ClusterIP   10.222.251.161   <none>        443/TCP         1h

Using a proxy, execute the following command:

[[email protected] ~]# kubectl proxy  --port=8001 --address=‘10.0.0.1‘ --accept-hosts=‘^.*‘Starting to serve on 10.0.0.1:8001

Enter the address in the browser: http://10.0.0.1:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/

If there is no accident, you will see the following interface:

Follow this prompt to create a user Https://github.com/kubernetes/dashboard/wiki/Creating-sample-user

Then get token and sign in with token:

kubectl describe secret -n kube-system `kubectl get secret -n kube-system |grep admin-user |awk ‘{print $1}‘`

You can also log in through the master node to access this address: https://10.0.0.1:6443/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/

The main interface is displayed after successful login:

Kubernetes Dashboard and DNS deployment

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.