Sunday, July 1, 2018

Kubernetes 1.10.0 multi-master installation with 3 Master and 3 Slave nodes installation and configuration with CentOS7 and SSL - Installation of kube-dns and testing


Creation of kubernetes kube-dns service


Here this file is edited to set the value of the clutserIP for the DNS service.

clusterIP: 100.65.0.10

kubectl create -f kube-dns.yaml


service "kube-dns" created
serviceaccount "kube-dns" created
configmap "kube-dns" created
deployment.extensions "kube-dns" created



Testing if kube-dns service is working properly
Please note that as JQ command is used, in the minimal install of CentOS7 JQ is not there. Also this is available from the EPEL repo for CentOS.
Installation of JQ
yum -y install epel-release
yum clean all
rm -rf /var/cache/yum
yum -y install jq
yum -y remove epel-release
yum clean all
rm -rf /var/cahce/yum
Creation of a BusyBox deployment to test the DNS
kubectl run busybox --image=busybox --command -- sleep 3600
kubectl get pods -l run=busybox

POD_NAME=$(kubectl get pods -l run=busybox -o json | jq .items[0].metadata.name| tr -d \")
echo $POD_NAME
kubectl exec -ti $POD_NAME -- nslookup kubernetes
You can see that the service names are getting resolved here.

Server:    100.65.0.10
Address 1: 100.65.0.10 kube-dns.kube-system.svc.cluster.local

Name:      kubernetes
Address 1: 100.65.0.1 kubernetes.default.svc.cluster.local

Resolving external names
[root@kuben1 ~]# kubectl exec -ti $POD_NAME -- nslookup google.com
Server:    100.65.0.10
Address 1: 100.65.0.10 kube-dns.kube-system.svc.cluster.local

Name:      google.com
Address 1: 2404:6800:4005:808::200e hkg12s13-in-x0e.1e100.net
Address 2: 216.58.203.46 hkg12s10-in-f46.1e100.net

No comments:

Post a Comment