我在AWS中有两个Kubernetes集群,每个集群都在自己的VPC中。
我想通过VPC对等从cluster1向cluster2发出http(s)请求。 VPC对等已建立,我可以将主机从Cluster1 ping通到Cluster2中的主机。
如何创建可以从Cluster2中的Cluster1连接到的服务。我有使用外部ELB等设置服务的经验,但是在这种情况下,内部服务却没有。
答案 0 :(得分:2)
您可以创建internal LoadBalancer。
您需要做的就是创建类型为LoadBalancer的常规服务,并使用以下注释对其进行注释:
SDL_Surface* surface = SDL_LoadBMP("..\\res\\test.bmp");
Uint32 pf = SDL_GetWindowPixelFormat(window);
int w=0, h=0, p=0;
Uint8* pixels = copySurfacePixels(surface, pf, renderer, &w, &h, &p);
if (pixels)
{
printf("width=%d, height=%d, pitch=%d\n", w, h, p);
// Print color at (1,1)
int x=1, y=1;
// Assuming BGRA format
int b = pixels[4 * (y * w + x) + 0]; // Blue
int g = pixels[4 * (y * w + x) + 1]; // Green
int r = pixels[4 * (y * w + x) + 2]; // Red
int a = pixels[4 * (y * w + x) + 3]; // Alpha
printf("Pixel at (%d,%d) has RGBA color (%d,%d,%d,%d)\n", x, y, r, g, b, a);
}
free(pixels);
答案 1 :(得分:1)
使用内部负载均衡器。
apiVersion: v1
kind: Service
metadata:
name: cluster2-service
namespace: test
annotations:
service.beta.kubernetes.io/aws-load-balancer-internal: "true"
这将指示CNI在专用子网上分配elb,这应使群集中位于其后的服务可从另一个vpc访问。