Outline:
? How to discover services in Kubernetes
? How to discover the services provided by pod
? How to use service discovery Services
? How to use the Kube-dns discovery service
? Kube-dns principle
? Composition
? Domain name format
? Configuration
Note: this share is based on the
This article will be based on the previous article on the configuration of the DNS service in the Kubernetes cluster environment, in the k8s cluster, pod life cycle is short, pod restart IP address will change, for the application this is unacceptable, in order to solve this problem, The k8s cluster cleverly introduces the DNS service to realize the discovery of
Service discovery mechanism Kubernetes provides two ways to discover the service:1. Environment Variables When the pod is running, Kubernetes writes the information for the service that existed before This method requires that the pod must be started after the service. The pod that was started before the service will not have an environment variable for that service. There is no such limit in the way
Outline:
How to discover services in KubernetesHow to discover how pod-provided services use the Service Discovery service to use the Kube-dns discovery service
Kube-dns principleCompose domain name format configuration
Note: This share is based on the Kubernetes 1.2 version.
Let's start with a simple example. 1. How to discover service in
The core issue in Kubernetes architecture is how data is persistance, although it provides persistent volumn, but it is difficult to run and manage products like databases in a kubernetes cluster environment. Kubernetes provides endpoints this mode to map external services into internal services, which solves the probl
[TOC]After DNS is installed, the pod can resolve the service through DNS to enable communicationKubernetes version:kubectl version My current version is 1.9.0.1, kubectl DNS installation 1.1 Download the configuration file on the official websitehttps://github.com/kubernetes/kube
Kubernetes (k8s) DNS Service Restarts the resolution repeatedly:
k8s.io/dns/pkg/dns/dns.go:150:failed to List *v1. Service:get https://10.96.0.1:443/api/v1/services?resourceVersion=0:dial TCP 10.96.0.1:443:getsockopt:no route to Host
When deploying the Kubernetes service u
Kube-dns compositionKube-dns can solve the service discovery problem, k8s registers the service name as a domain name into Kube-dns, and can access the services it provides through the name of the service.Kube-dns of four components: ETCD, which is used to save DNS rules.
the IP needs to be within the specified IP address range of the Kube-apiserver boot parameter –service-cluster-ip-range. and Skydns If it is a localized installation, it is not possible to bind the IP of the DNS server to the IP of a virtual network (that is, the value of the parameter-addr). I would prefer to install it using mirroring mode. InstallationThe contents of the file Kubernetes-dns.yaml as foll
that can be connected within the cluster. Nodeport and LoadBalancer are two types that open services to external networks. The legal value of the ServiceType field is: L Clusterip: Use only one IP address within the cluster-this is the default. Choosing this value means that you only want the service to be accessible within the cluster. L Nodeport: on the basis of the internal IP of the cluster, the service is opened on the port of each node of the c
Tag: data adb supports using the log Web to restrict class load1: The most used is Nodeport, the following Nginx service, the type is set to Nodeport, while Nodeport is set to 30010 (k8s in order not to conflict with the host port, the default limit of 30000 ports below)This allows access to Nginx via any node ip+30010apiVersion:v1kind:Servicemetadata: name:my-nginx Labels: run:my-Nginxspec: Ports: -port:80 protocol:tcp 30010 type:nodeport selector: run:my-nginx2:loadbalancer
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.