kubernetes的Ingress资源介绍
Posted rdchenxi
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了kubernetes的Ingress资源介绍相关的知识,希望对你有一定的参考价值。
Ingress 的资源帮助信息介绍
[root@master ~]# kubectl explain ingress KIND: Ingress VERSION: extensions/v1beta1 DESCRIPTION: Ingress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend. An Ingress can be configured to give services externally-reachable urls, load balance traffic, terminate SSL, offer name based virtual hosting etc. DEPRECATED - This group version of Ingress is deprecated by networking.k8s.io/v1beta1 Ingress. See the release notes for more information. FIELDS: apiVersion <string> APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources kind <string> Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds metadata <Object> 元数据 Standard object‘s metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata spec <Object> 期望状态 Spec is the desired state of the Ingress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status status <Object> Status is the current state of the Ingress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
查看期望状态的帮助信息
[root@master ~]# kubectl explain ingress.spec KIND: Ingress VERSION: extensions/v1beta1 RESOURCE: spec <Object> DESCRIPTION: Spec is the desired state of the Ingress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status IngressSpec describes the Ingress the user wishes to exist. FIELDS: backend <Object> 后端的pod A default backend capable of servicing requests that don‘t match any rule. At least one of ‘backend‘ or ‘rules‘ must be specified. This field is optional to allow the loadbalancer controller or defaulting logic to specify a global default. rules <[]Object> 规则 A list of host rules used to configure the Ingress. If unspecified, or no rule matches, all traffic is sent to the default backend. tls <[]Object> TLS configuration. Currently the Ingress only supports a single TLS port, 443. If multiple members of this list specify different hosts, they will be multiplexed on the same port according to the hostname specified through the SNI TLS extension, if the ingress controller fulfilling the ingress supports SNI.
调度的规则
[root@master ~]# kubectl explain ingress.spec.rules KIND: Ingress VERSION: extensions/v1beta1 RESOURCE: rules <[]Object> DESCRIPTION: A list of host rules used to configure the Ingress. If unspecified, or no rule matches, all traffic is sent to the default backend. IngressRule represents the rules mapping the paths under a specified host to the related backend services. Incoming requests are first evaluated for a host match, then routed to the backend associated with the matching IngressRuleValue. FIELDS: host <string> 主机名 Host is the fully qualified domain name of a network host, as defined by RFC 3986. Note the following deviations from the "host" part of the URI as defined in the RFC: 1. IPs are not allowed. Currently an IngressRuleValue can only apply to the IP in the Spec of the parent Ingress. 2. The `:` delimiter is not respected because ports are not allowed. Currently the port of an Ingress is implicitly :80 for http and :443 for https. Both these may change in the future. Incoming requests are matched against the host before the IngressRuleValue. If the host is unspecified, the Ingress routes all traffic based on the specified IngressRuleValue. http <Object> url
基于主机名匹配
[root@master ~]# kubectl explain ingress.spec.rules.host KIND: Ingress VERSION: extensions/v1beta1 FIELD: host <string> DESCRIPTION: Host is the fully qualified domain name of a network host, as defined by RFC 3986. Note the following deviations from the "host" part of the URI as defined in the RFC: 1. IPs are not allowed. Currently an IngressRuleValue can only apply to the IP in the Spec of the parent Ingress. 2. The `:` delimiter is not respected because ports are not allowed. Currently the port of an Ingress is implicitly :80 for http and :443 for https. Both these may change in the future. Incoming requests are matched against the host before the IngressRuleValue. If the host is unspecified, the Ingress routes all traffic based on the specified IngressRuleValue.
url匹配
[root@master ~]# kubectl explain ingress.spec.rules.http KIND: Ingress VERSION: extensions/v1beta1 RESOURCE: http <Object> DESCRIPTION: HTTPIngressRuleValue is a list of http selectors pointing to backends. In the example: http://<host>/<path>?<searchpart> -> backend where where parts of the url correspond to RFC 3986, this resource will be used to match against everything after the last ‘/‘ and before the first ‘?‘ or ‘#‘. FIELDS: paths <[]Object> -required- A collection of paths that map requests to backends.
后端pod的帮助信息
KIND: Ingress VERSION: extensions/v1beta1 RESOURCE: backend <Object> DESCRIPTION: A default backend capable of servicing requests that don‘t match any rule. At least one of ‘backend‘ or ‘rules‘ must be specified. This field is optional to allow the loadbalancer controller or defaulting logic to specify a global default. IngressBackend describes all endpoints for a given service and port. FIELDS: serviceName <string> -required- 后端server的名字的定义 Specifies the name of the referenced service. servicePort <string> -required- 端口 Specifies the port of the referenced service.
以上是关于kubernetes的Ingress资源介绍的主要内容,如果未能解决你的问题,请参考以下文章
Kubernetes Ingress Nginx 加载资源 404