我只是第一次在服务上设置istio,但无法使网关/网关正常工作。
这是我的配置,与文档一致:
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: dragon-gateway
spec:
selector:
# use Istio default gateway implementation
istio: ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: dragon
spec:
hosts:
- "vtest.westus.cloudapp.azure.com"
gateways:
- dragon-gateway
http:
- match:
- uri:
prefix: /
- uri:
prefix: /status
- uri:
prefix: /delay
- uri:
prefix: /api/values
route:
- destination:
host: dragon
port:
number: 80
kubectl描述看起来不错:
Name: dragon-gateway
Namespace: default
Labels: <none>
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"networking.istio.io/v1alpha3","kind":"Gateway","metadata":{"annotations":{},"name":"dragon-gateway","namespace":"default"},...
API Version: networking.istio.io/v1alpha3
Kind: Gateway
Metadata:
Creation Timestamp: 2019-09-22T22:54:31Z
Generation: 1
Resource Version: 723889
Self Link: /apis/networking.istio.io/v1alpha3/namespaces/default/gateways/dragon-gateway
UID: f0738082-dd8b-11e9-b099-e259debf6109
Spec:
Selector:
Istio: ingressgateway
Servers:
Hosts:
*
Port:
Name: http
Number: 80
Protocol: HTTP
Name: dragon
Namespace: default
Labels: <none>
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"networking.istio.io/v1alpha3","kind":"VirtualService","metadata":{"annotations":{},"name":"dragon","namespace":"default"},"...
API Version: networking.istio.io/v1alpha3
Kind: VirtualService
Metadata:
Creation Timestamp: 2019-09-22T22:54:31Z
Generation: 1
Resource Version: 723891
Self Link: /apis/networking.istio.io/v1alpha3/namespaces/default/virtualservices/dragon
UID: f0988c3c-dd8b-11e9-b099-e259debf6109
Spec:
Gateways:
dragon-gateway
Hosts:
vtest.westus.cloudapp.azure.com
Http:
Match:
Uri:
Prefix: /
Uri:
Prefix: /status
Uri:
Prefix: /delay
Uri:
Prefix: /api/values
Route:
Destination:
Host: dragon
Port:
Number: 80
该服务的配置如下:
apiVersion: v1
kind: Service
metadata:
namespace: flight
name: dragon
labels:
app: dragon
release: r1
version: 1.0.0
spec:
type: ClusterIP
ports:
- name: http
port: 80
targetPort: 80
- name: https
port: 443
targetPort: 80
selector:
app: dragon
release: r1
docker文件非常简单:
FROM microsoft/dotnet:latest AS runtime
# ports
EXPOSE 80
EXPOSE 443
WORKDIR /
COPY /publish /app
RUN dir /app
WORKDIR /app
FROM runtime AS final
ENTRYPOINT ["dotnet", "dragon.dll"]
如果您有任何想法请告诉我。我试着从另一个吊舱中卷曲,它起作用了。问题是使用外部IP或分配给网关的内部IP。这些都不起作用。
预先感谢您提供任何线索。
编辑:
添加有关卷曲的更多信息
curl 40.118.228.111/api/values -v
* Trying 40.118.228.111...
* TCP_NODELAY set
* Connected to 40.118.228.111 (40.118.228.111) port 80 (#0)
> GET /api/values HTTP/1.1
> Host: 40.118.228.111
> User-Agent: curl/7.55.1
> Accept: */*
>
< HTTP/1.1 404 Not Found
< date: Sun, 22 Sep 2019 23:27:54 GMT
< server: istio-envoy
< content-length: 0
<
* Connection #0 to host 40.118.228.111 left intact
也添加代理状态:
NAME CDS LDS EDS RDS PILOT VERSION
dragon-dc789456b-g9fxb.flight SYNCED SYNCED SYNCED (50%) SYNCED istio-pilot-689d75bc8-j7j8m 1.1.3
istio-ingressgateway-5c4f9f859d-nj9sq.istio-system SYNCED SYNCED SYNCED (100%) SYNCED istio-pilot-689d75bc8-j7j8m 1.1.3
答案 0 :(得分:0)
好像您将//list.h
class DLinkedList { // doubly linked list
public:
DLinkedList(); // constructor
~DLinkedList(); // destructor
bool empty() const; // is list empty?
const Elem& front() const; // get front element
const Elem& back() const; // get back element
void addFront(const Elem& e); // add to front of list
void addBack(const Elem& e); // add to back of list
void removeFront(); // remove from front
void removeBack(); // remove from back
private: // local type definitions
DNode* header; // list sentinels
DNode* trailer;
protected: // local utilities
void add(DNode* v, const Elem& e); // insert new node before v
void remove(DNode* v); // remove node v
};
VirtualService和dragon
放在默认名称空间中一样?
由于服务名称依赖dns,并且pod的resolv.conf搜索路径通常仅包含本地名称空间,因此服务名称dragon-gateway
仅在相同名称空间中正确解析。而是将fqdn用于dragon
服务:
dragon
您已将istio配置为基于主机名进行路由,但是curl命令使用的是IP地址。使用这样的A记录配置DNS-...
route:
- destination:
host: dragon.flight.svc.cluster.local
port:
number: 80
-> vtest.westus.cloudapp.azure.com
,或者强制curl发送正确的主机头:
40.118.228.111
答案 1 :(得分:0)
您好,我不是istio方面的专家,但是经过调查之后,您似乎可以使用主机和istio网关,您应该使用void calledSomeWhere()
{
static std::vector<RAWINPUT> raw_inputs;
raw_inputs.clear();
raw_inputs.resize(1024);
uint32_t raw_input_size = (uint32_t)(sizeof(RAWINPUT) * raw_inputs.size());
UINT input_count = GetRawInputBuffer(raw_inputs.data(), &raw_input_size, sizeof(RAWINPUTHEADER));
if (input_count == (UINT)-1) {
return ErrorStack(ExtraError::FAILED_TO_GET_RAW_INPUT_BUFFER, code_location, "failed to get raw input buffer", getLastError());
}
else if (input_count) {
printf("input_count = %d \n", input_count);
for (uint32_t i = 0; i < input_count; i++) {
RAWINPUT& raw_input = raw_inputs[i];
if (raw_input.header.dwType == RIM_TYPEMOUSE) {
printf("%d %d \n", raw_input.data.mouse.lLastX, raw_input.data.mouse.lLastY);
}
}
}
}
才能通过Host prefix
来使用virtualnetworkservices,
like this:
host HTTP Header
这是必需的,因为您的入口网关已配置为处理“ httpbin.example.com”,但是在测试环境中,该主机没有DNS绑定,只是将您的请求发送到入口IP。
从另一个角度来看,此设置必须与Vitualservice匹配:
VirtualService必须绑定到网关,并且必须具有一个或多个与服务器中指定的主机匹配的主机。
指定curl -I -HHost:httpbin.example.com http://$INGRESS_HOST:$INGRESS_PORT/
绑定所有主机名。
另外,您可以使用这种方法限制虚拟服务或为主机(如主机)指定服务器的多个规则。
您可以在此处找到更高级的示例-Istio Server:
希望获得帮助。