liqo学习及安装,k8s,kubernetes多集群互联

先按照官方的教程在虚拟机安装学习

在开始以下教程之前,您应该确保您的系统上安装了以下软件:

  • Docker,容器运行时。
  • Kubectl,Kubernetes 的命令行工具。
 curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectlkubectl version --client
  • Helm,Kubernetes 的包管理器。
 curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bashhelm version
  • curl,通过 HTTP/HTTPS 与教程应用程序交互。
  • Kind,Docker 运行时中的 Kubernetes。(在docker中运行的Kubernetes,主要做测试用)
#For AMD64 / x86_64
[ $(uname -m) = x86_64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.22.0/kind-linux-amd64
#For ARM64
[ $(uname -m) = aarch64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.22.0/kind-linux-arm64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
kind version
  • liqoc​​tl与 Liqo 交互的命令行工具。
 #AMD64:
curl --fail -LS "https://github.com/liqotech/liqo/releases/download/v0.10.2/liqoctl-linux-amd64.tar.gz" | tar -xz
sudo install -o root -g root -m 0755 liqoctl /usr/local/bin/liqoctl
#ARM64:
curl --fail -LS "https://github.com/liqotech/liqo/releases/download/v0.10.2/liqoctl-linux-arm64.tar.gz" | tar -xz
sudo install -o root -g root -m 0755 liqoctl /usr/local/bin/liqoctl

创建虚拟集群

然后,让我们在计算机上打开一个终端并启动以下脚本,该脚本将使用 Kind 创建一对集群。每个集群由两个节点组成(一个用于控制平面,一个作为简单工作节点):

git clone https://github.com/liqotech/liqo.git
cd liqo
git checkout v0.10.2
cd examples/quick-start
./setup.sh

此步骤如果报错: failed to create cluster: failed to init node with kubeadm: command “docker exec --privileged rome-control-plane kubeadm init --skip-phases=preflight --config=/kind/kubeadm.conf --skip-token-print --v=6” failed with error: exit status 1
Command Output: I0419 00:55:49.069409 44 initconfiguration.go:254] loading configuration from “/kind/kubeadm.conf”

the HTTP call equal to ‘curl -sSL http://localhost:10248/healthz’ failed with error: Get “http://localhost:10248/healthz”: dial tcp [::1]:10248: connect: connection refused.
在这里插入图片描述
排查:
直接用 kind create cluster --name rome 是成功的,发现Ensuring node image:kindest/node:v1.29.2
而用./setup.sh执行的是v1.25.0
在这里插入图片描述
解决办法:
直接改/opt/liqo/examples/quick-start/manifests/cluster.yam里面的kindest/node改成v1.29.2

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
networking:serviceSubnet: "10.90.0.0/12"podSubnet: "10.200.0.0/16"
nodes:- role: control-planeimage: kindest/node:v1.25.0  #这里改成v1.29.2- role: workerimage: kindest/node:v1.25.0  #这里改成v1.29.2

详情请点击

在执行:

root@main:~/liqo/examples/quick-start# ./setup.sh 
SUCCESS	No cluster "rome" is running.
SUCCESS	No cluster "milan" is running.
SUCCESS	Cluster "rome" has been created.
SUCCESS	Cluster "milan" has been created.
root@main:~/liqo/examples/quick-start# 

测试集群

您可以通过键入以下内容来检查已部署的集群:

root@main:~/liqo/examples/quick-start# kind get clusters
milan
rome
root@main:~/liqo/examples/quick-start# 

这意味着您的主机上部署并运行了两个 Kind 集群。
默认情况下,两个集群的 kubeconfig 存储在当前目录(./liqo_kubeconf_rome, ./liqo_kubeconf_milan)中。

root@main:~/liqo/examples/quick-start# pwd
/root/liqo/examples/quick-start
root@main:~/liqo/examples/quick-start# ls
liqo_kubeconf_milan  liqo_kubeconf_rome  manifests  setup.sh
root@main:~/liqo/examples/quick-start# 

您可以通过以下方式导出本教程其余部分使用的适当环境变量(即KUBECONFIG和KUBECONFIG_MILAN),并引用它们的位置:

export KUBECONFIG="$PWD/liqo_kubeconf_rome"
export KUBECONFIG_MILAN="$PWD/liqo_kubeconf_milan"

永久配置:

sudo vim ~/.bashrc
export KUBECONFIG="$PWD/liqo_kubeconf_rome"
export KUBECONFIG_MILAN="$PWD/liqo_kubeconf_milan"

建议将第一个集群的 kubeconfig 导出为默认值(即KUBECONFIG),因为它将是虚拟集群的入口点,您将主要与其交互。

在第一个集群上,您只需输入以下内容即可获取可用的 Pod:

root@liqo:~/liqo/examples/quick-start# kubectl get pods -A
NAMESPACE            NAME                                         READY   STATUS    RESTARTS   AGE
kube-system          coredns-76f75df574-m5ppl                     1/1     Running   0          110s
kube-system          coredns-76f75df574-mljgc                     1/1     Running   0          110s
kube-system          etcd-rome-control-plane                      1/1     Running   0          2m6s
kube-system          kindnet-p9cjf                                1/1     Running   0          107s
kube-system          kindnet-pg7bt                                1/1     Running   0          110s
kube-system          kube-apiserver-rome-control-plane            1/1     Running   0          2m4s
kube-system          kube-controller-manager-rome-control-plane   1/1     Running   0          2m4s
kube-system          kube-proxy-gh5kr                             1/1     Running   0          110s
kube-system          kube-proxy-l67g5                             1/1     Running   0          107s
kube-system          kube-scheduler-rome-control-plane            1/1     Running   0          2m4s
local-path-storage   local-path-provisioner-7577fdbbfb-ct9rz      1/1     Running   0          110s

同样,在第二个集群上,您可以观察执行中的 Pod:

kubectl get pods -A --kubeconfig "$KUBECONFIG_MILAN"

安装Liqo

现在,您将使用以下名称在两个集群上安装 Liqo

  • rome:本地集群,您将在其中部署和控制应用程序。

  • milan:远程集群,部分工作负载将被卸载到该集群。

您可以通过启动以下命令在rome集群上安装 Liqo:

liqoctl install kind --cluster-name rome

这里一直报错,安装不成功

 ERRO  Error installing or upgrading Liqo: release liqo failed, and has been uninstalled due to atomic being set: timed out waiting for the condition                                                                                                                                    INFO  Likely causes for the installation/upgrade timeout could include:INFO  * One or more pods failed to start (e.g., they are in the ImagePullBackOff status)INFO  * A service of type LoadBalancer has been configured, but no provider is availableINFO  You can add the --verbose flag for debug information concerning the failing resourcesINFO  Additionally, if necessary, you can increase the timeout value with the --timeout flag

根据提示,运行:liqoctl install kind --cluster-name rome --verbose 展示详情信息:

 Starting delete for "liqo-webhook-certificate-patch" ServiceAccount                                                                                                                                                                                                               INFO  beginning wait for 1 resources to be deleted with timeout of 10m0s                                                                                                                                                                                                                INFO  creating 1 resource(s)                                                                                                                                                                                                                                                            INFO  Starting delete for "liqo-webhook-certificate-patch" Role                                                                                                                                                                                                                         INFO  beginning wait for 1 resources to be deleted with timeout of 10m0s                                                                                                                                                                                                                INFO  creating 1 resource(s)                                                                                                                                                                                                                                                            INFO  Starting delete for "liqo-webhook-certificate-patch" RoleBinding                                                                                                                                                                                                                  INFO  beginning wait for 1 resources to be deleted with timeout of 10m0s                                                                                                                                                                                                                INFO  creating 1 resource(s)                                                                                                                                                                                                                                                            INFO  Starting delete for "liqo-webhook-certificate-patch-pre" Job                                                                                                                                                                                                                      INFO  beginning wait for 1 resources to be deleted with timeout of 10m0s                                                                                                                                                                                                                INFO  creating 1 resource(s)                                                                                                                                                                                                                                                            INFO  Watching for changes to Job liqo-webhook-certificate-patch-pre with timeout of 10m0s                                                                                                                                                                                              INFO  Add/Modify event for liqo-webhook-certificate-patch-pre: ADDED                                                                                                                                                                                                                    INFO  liqo-webhook-certificate-patch-pre: Jobs active: 0, jobs failed: 0, jobs succeeded: 0                                                                                                                                                                                             INFO  Add/Modify event for liqo-webhook-certificate-patch-pre: MODIFIED                                                                                                                                                                                                                 INFO  liqo-webhook-certificate-patch-pre: Jobs active: 1, jobs failed: 0, jobs succeeded: 0                                                                                                                                                                                             INFO  Install failed and atomic is set, uninstalling release       .....Ignoring delete failure for "liqo-telemetry" /v1, Kind=ServiceAccount: serviceaccounts "liqo-telemetry" not found                                                                                                                                                                 INFO  Ignoring delete failure for "liqo-crd-replicator" /v1, Kind=ServiceAccount: serviceaccounts "liqo-crd-replicator" not found                                                                                                                                                       INFO  Ignoring delete failure for "liqo-gateway" /v1, Kind=ServiceAccount: serviceaccounts "liqo-gateway" not found                                                                                                                                                                     INFO  Ignoring delete failure for "liqo-auth" /v1, Kind=ServiceAccount: serviceaccounts "liqo-auth" not found                                                                                                                                                                           INFO  Ignoring delete failure for "liqo-network-manager" /v1, Kind=ServiceAccount: serviceaccounts "liqo-network-manager" not found                                                                                                                                                     INFO  Ignoring delete failure for "liqo-route" /v1, Kind=ServiceAccount: serviceaccounts "liqo-route" not found                                                                                                                                                                         INFO  Ignoring delete failure for "liqo-controller-manager" /v1, Kind=ServiceAccount: serviceaccounts "liqo-controller-manager" not found                                                                                                                                               INFO  Ignoring delete failure for "liqo-metric-agent" /v1, Kind=ServiceAccount: serviceaccounts "liqo-metric-agent" not found                                                                                                                                                           INFO  Starting delete for "liqo-webhook" MutatingWebhookConfiguration                                                                                                                                                                                                                   INFO  Ignoring delete failure for "liqo-webhook" admissionregistration.k8s.io/v1, Kind=MutatingWebhookConfiguration: mutatingwebhookconfigurations.admissionregistration.k8s.io "liqo-webhook" not found                                                                                INFO  Starting delete for "liqo-webhook" ValidatingWebhookConfiguration                                                                                                                                                                                                                 INFO  Ignoring delete failure for "liqo-webhook" admissionregistration.k8s.io/v1, Kind=ValidatingWebhookConfiguration: validatingwebhookconfigurations.admissionregistration.k8s.io "liqo-webhook" not found                                                                            INFO  purge requested for liqo                                                                                                                                                                                                                                                          ERRO  Error installing or upgrading Liqo: release liqo failed, and has been uninstalled due to atomic being set: timed out waiting for the condition                                                                                                                                    INFO  Likely causes for the installation/upgrade timeout could include:INFO  * One or more pods failed to start (e.g., they are in the ImagePullBackOff status)INFO  * A service of type LoadBalancer has been configured, but no provider is availableINFO  You can add the --verbose flag for debug information concerning the failing resourcesINFO  Additionally, if necessary, you can increase the timeout value with the --timeout flag

这里还不太清楚怎么办,看情况好像是liqo-webhook相关的东西不行,又看到提示"One or more pods failed to start (e.g., they are in the ImagePullBackOff status)"
然后执行了下kubectl get pods -A 发现liqo-webhook-certificate-patch-pre-dxqj9 没拉取下来

root@liqo:~/liqo/examples/quick-start# kubectl get pods -A
NAMESPACE            NAME                                         READY   STATUS             RESTARTS   AGE
kube-system          coredns-76f75df574-prq94                     1/1     Running            0          63m
kube-system          coredns-76f75df574-xljfr                     1/1     Running            0          63m
kube-system          etcd-rome-control-plane                      1/1     Running            0          63m
kube-system          kindnet-5g85h                                1/1     Running            0          63m
kube-system          kindnet-74l4j                                1/1     Running            0          63m
kube-system          kube-apiserver-rome-control-plane            1/1     Running            0          63m
kube-system          kube-controller-manager-rome-control-plane   1/1     Running            0          63m
kube-system          kube-proxy-86v24                             1/1     Running            0          63m
kube-system          kube-proxy-9c9df                             1/1     Running            0          63m
kube-system          kube-scheduler-rome-control-plane            1/1     Running            0          63m
liqo                 liqo-webhook-certificate-patch-pre-dxqj9     0/1     ImagePullBackOff   0          25m
local-path-storage   local-path-provisioner-7577fdbbfb-7vxcq      1/1     Running            0          63m
root@liqo:~/liqo/examples/quick-start# kubectl logs -f -n liqo liqo-webhook-certificate-patch-pre-dxqj9 
Error from server (BadRequest): container "create" in pod "liqo-webhook-certificate-patch-pre-dxqj9" is waiting to start: image can't be pulled

然后去官方仓库搜索webhook-certificate 发现
在这里插入图片描述
执行 kubectl describe job liqo-webhook-certificate-patch --namespace=liqo

root@liqo:~/liqo/examples/quick-start# kubectl describe job liqo-webhook-certificate-patch --namespace=liqo
Name:                        liqo-webhook-certificate-patch-pre
Namespace:                   liqo
Selector:                    batch.kubernetes.io/controller-uid=54b6ee31-c866-487f-a874-4c71ec3a872c
Labels:                      app.kubernetes.io/component=webhook-certificate-patchapp.kubernetes.io/instance=liqo-webhook-certificate-patch-preapp.kubernetes.io/managed-by=Helmapp.kubernetes.io/name=webhook-certificate-patch-preapp.kubernetes.io/part-of=liqoapp.kubernetes.io/version=v0.10.2helm.sh/chart=liqo-v0.10.2
Annotations:                 helm.sh/hook: pre-install,pre-upgradehelm.sh/hook-delete-policy: before-hook-creation,hook-succeeded
Parallelism:                 1
Completions:                 1
Completion Mode:             NonIndexed
Suspend:                     false
Backoff Limit:               6
TTL Seconds After Finished:  150
Start Time:                  Fri, 19 Apr 2024 07:04:18 +0000
Pods Statuses:               1 Active (0 Ready) / 0 Succeeded / 0 Failed
Pod Template:Labels:           app.kubernetes.io/component=webhook-certificate-patchapp.kubernetes.io/instance=liqo-webhook-certificate-patch-preapp.kubernetes.io/managed-by=Helmapp.kubernetes.io/name=webhook-certificate-patch-preapp.kubernetes.io/part-of=liqoapp.kubernetes.io/version=v0.10.2batch.kubernetes.io/controller-uid=54b6ee31-c866-487f-a874-4c71ec3a872cbatch.kubernetes.io/job-name=liqo-webhook-certificate-patch-precontroller-uid=54b6ee31-c866-487f-a874-4c71ec3a872chelm.sh/chart=liqo-v0.10.2job-name=liqo-webhook-certificate-patch-preService Account:  liqo-webhook-certificate-patchContainers:create:Image:      k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.1.1Port:       <none>Host Port:  <none>Args:create--host=liqo-controller-manager,liqo-controller-manager.liqo,liqo-controller-manager.liqo.svc,liqo-controller-manager.liqo.svc.cluster.local--namespace=liqo--secret-name=liqo-webhook-certs--cert-name=tls.crt--key-name=tls.keyEnvironment:   <none>Mounts:        <none>Volumes:         <none>Node-Selectors:  <none>Tolerations:     <none>
Events:Type    Reason            Age   From            Message----    ------            ----  ----            -------Normal  SuccessfulCreate  29m   job-controller  Created pod: liqo-webhook-certificate-patch-pre-dxqj9

发现image是:k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.1.1
这里安装过k8s的都知道,会有这个问题 k8s.gcr.io会访问不到。
这里卡了好久,k8s可以指定–image-repository 但是他不支持

liqoctl install kind --cluster-name rome --image-repository=registry.cn-hangzhou.aliyuncs.com/google_containers  --verbose 
Error: unknown flag: --image-repository
root@liqo:~/liqo/examples/quick-start# kubectl get pods -A

然后拉取aliyuncs的kube-webhook-certgen,打tag,在重新删除pod从新运行pod也是不行:

root@liqo:~/liqo/examples/quick-start# docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/kube-webhook-certgen:v1.1.1
v1.1.1: Pulling from google_containers/kube-webhook-certgen
ec52731e9273: Pull complete 
b90aa28117d4: Pull complete 
Digest: sha256:64d8c73dca984af206adf9d6d7e46aa550362b1d7a01f3a0a91b20cc67868660
Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/google_containers/kube-webhook-certgen:v1.1.1
registry.cn-hangzhou.aliyuncs.com/google_containers/kube-webhook-certgen:v1.1.1
root@liqo:~/liqo/examples/quick-start#  docker tag registry.cn-hangzhou.aliyuncs.com/google_containers/kube-webhook-certgen:v1.1.1 k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.1.1
root@liqo:~/liqo/examples/quick-start# docker images
REPOSITORY                                                                 TAG       IMAGE ID       CREATED         SIZE
kindest/node                                                               v1.29.2   09c50567d34e   2 months ago    956MB
kindest/node                                                               v1.25.0   d3da246e125a   19 months ago   870MB
k8s.gcr.io/ingress-nginx/kube-webhook-certgen                              v1.1.1    c41e9fcadf5a   2 years ago     47.7MB
registry.cn-hangzhou.aliyuncs.com/google_containers/kube-webhook-certgen   v1.1.1    c41e9fcadf5a   2 years ago     47.7MB
root@liqo:~/liqo/examples/quick-start# kubectl delete pod liqo-webhook-certificate-patch-pre-fj72j -n liqo
pod "liqo-webhook-certificate-patch-pre-fj72j" deleted
root@liqo:~/liqo/examples/quick-start# kubectl get pods -A
NAMESPACE            NAME                                         READY   STATUS              RESTARTS   AGE
kube-system          coredns-76f75df574-prq94                     1/1     Running             0          159m
kube-system          coredns-76f75df574-xljfr                     1/1     Running             0          159m
kube-system          etcd-rome-control-plane                      1/1     Running             0          159m
kube-system          kindnet-5g85h                                1/1     Running             0          159m
kube-system          kindnet-74l4j                                1/1     Running             0          159m
kube-system          kube-apiserver-rome-control-plane            1/1     Running             0          159m
kube-system          kube-controller-manager-rome-control-plane   1/1     Running             0          159m
kube-system          kube-proxy-86v24                             1/1     Running             0          159m
kube-system          kube-proxy-9c9df                             1/1     Running             0          159m
kube-system          kube-scheduler-rome-control-plane            1/1     Running             0          159m
liqo                 liqo-webhook-certificate-patch-pre-jk979     0/1     ContainerCreating   0          3s
local-path-storage   local-path-provisioner-7577fdbbfb-7vxcq      1/1     Running             0          159m

最后还是创建失败,ImagePullBackOff。这里我的原理不太懂,打标签之后也没直接用我pull下来的镜像,还是会去拉取,因为我安装k8s的时候直接指定–image-repository 所以不用什么拉取镜像打标签什么的,这里应该网上有的教程太老了吧,现在k8s都是直接用containerd了,k8s安装见k8s安装,linux-ubuntu上面kubernetes详细安装过程

接着又搜索怎么修改pod的image,各种试都不行,他是个job,k8s太多东西了,这个概念不清楚
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
到这里又行不通了,又看官网,发现执行的时候,可以指定这个webhook-certificate的image,删除liqo:

liqoctl uninstall --purge --kubeconfig="$KUBECONFIG"
liqoctl uninstall --purge --kubeconfig="$KUBECONFIG_MILAN"

等删除成功之后从新执行:

liqoctl install kind --cluster-name rome --verbose --set webhook.patch.image=registry.cn-hangzhou.aliyuncs.com/google_containers/kube-webhook-certgen:v1.1.1

成功

 INFO  Installer initialized                                                                                                                                                                                                                                                             INFO  Cluster configuration correctly retrieved                                                                                                                                                                                                                                         INFO  Installation parameters correctly generated                                                                                                                                                                                                                                       INFO  All Set! You can now proceed establishing a peering (liqoctl peer --help for more information)                                                                                                                                                                                    INFO  Make sure to use the same version of Liqo on all remote clusters

在Milan集群上也安装 Liqo :

root@liqo:~/liqo/examples/quick-start# liqoctl install kind --cluster-name milan --kubeconfig "$KUBECONFIG_MILAN" --set webhook.patch.image=registry.cn-hangzhou.aliyuncs.com/google_containers/kube-webhook-certgen:v1.1.1 --verbose

Liqo pod 已启动并运行:

root@liqo:~/liqo/examples/quick-start# kubectl get pods -n liqo
NAME                                      READY   STATUS    RESTARTS   AGE
liqo-auth-6bf849d75-ll25k                 1/1     Running   0          53m
liqo-controller-manager-7c586975f-d2k6c   1/1     Running   0          53m
liqo-crd-replicator-679cfc85cd-g85nb      1/1     Running   0          53m
liqo-gateway-759f8b7d4d-lsblm             1/1     Running   0          53m
liqo-metric-agent-77d765d9df-v4tp2        1/1     Running   0          53m
liqo-network-manager-dd886d8bc-9st79      1/1     Running   0          53m
liqo-proxy-6d49f7789b-klcp4               1/1     Running   0          53m
liqo-route-6nglb                          1/1     Running   0          53m
liqo-route-7z4vc                          1/1     Running   0          53m
root@liqo:~/liqo/examples/quick-start# 

此外,您可以使用以下命令检查安装状态和主要 Liqo 配置参数:

root@liqo:~/liqo/examples/quick-start# liqoctl status
┌─ Namespace existence check ──────────────────────────────────────────────────────┐
|  INFO  ✔ liqo control plane namespace liqo exists                                |
└──────────────────────────────────────────────────────────────────────────────────┘┌─ Control plane check ────────────────────────────────────────────────────────────┐
|  Deployment                                                                      |
|      liqo-controller-manager: Desired: 1, Ready: 1/1, Available: 1/1             |
|      liqo-crd-replicator:     Desired: 1, Ready: 1/1, Available: 1/1             |
|      liqo-metric-agent:       Desired: 1, Ready: 1/1, Available: 1/1             |
|      liqo-auth:               Desired: 1, Ready: 1/1, Available: 1/1             |
|      liqo-proxy:              Desired: 1, Ready: 1/1, Available: 1/1             |
|      liqo-network-manager:    Desired: 1, Ready: 1/1, Available: 1/1             |
|      liqo-gateway:            Desired: 1, Ready: 1/1, Available: 1/1             |
|  DaemonSet                                                                       |
|      liqo-route:              Desired: 2, Ready: 2/2, Available: 2/2             |
└──────────────────────────────────────────────────────────────────────────────────┘┌─ Local cluster information ──────────────────────────────────────────────────────┐
|  Cluster identity                                                                |
|      Cluster ID:   06b2ab0f-5dd0-42cb-aaca-73f92741b740                          |
|      Cluster name: rome                                                          |
|      Cluster labels                                                              |
|          liqo.io/provider: kind                                                  |
|  Configuration                                                                   |
|      Version: v0.10.2                                                            |
|  Network                                                                         |
|      Pod CIDR:      10.200.0.0/16                                                |
|      Service CIDR:  10.80.0.0/12                                                 |
|      External CIDR: 10.201.0.0/16                                                |
|  Endpoints                                                                       |
|      Network gateway:       udp://172.18.0.2:30620                               |
|      Authentication:        https://172.18.0.3:32395                             |
|      Kubernetes API server: https://172.18.0.3:6443                              |
└──────────────────────────────────────────────────────────────────────────────────┘

对等两个集群

就是把两个集群建立互连,在此示例中,由于两个 API 服务器(可以理解成两个k8s可以相互访问)可相互访问,因此您将使用带外对等互连方法。

首先,从Milan集群获取对等命令:

root@liqo:~/liqo/examples/quick-start# liqoctl generate peer-command --kubeconfig "$KUBECONFIG_MILAN"INFO  Peering information correctly retrieved                                                                                                                                                                                                                                           Execute this command on a *different* cluster to enable an outgoing peering with the current cluster:liqoctl peer out-of-band milan --auth-url https://172.18.0.4:31720 --cluster-id 0422b752-25e5-42d0-acbf-1d584b09d1a6 --auth-token dfd35fcb10d65c142738261c17d94724bd3bf2dd54e14ac344e22a0cee27b58a084f452ead3df1857e2bb9dd35d0d6ba5b03b7e507f220eff4c71785a42e7cae
root@liqo:~/liqo/examples/quick-start# 

rome:本地集群,您将在其中部署和控制应用程序。
milan:远程集群,部分工作负载将被卸载到该集群。
就是在rome集群执行pod相关的命令会到milan上?

其次,将命令复制粘贴到Rome集群中:

root@liqo:~/liqo/examples/quick-start# liqoctl peer out-of-band milan --auth-url https://172.18.0.4:31720 --cluster-id 0422b752-25e5-42d0-acbf-1d584b09d1a6 --auth-token dfd35fcb10d65c142738261c17d94724bd3bf2dd54e14ac344e22a0cee27b58a084f452ead3df1857e2bb9dd35d0d6ba5b03b7e507f220eff4c71785a42e7caeINFO  Peering enabled                                                                                                                                                                                                                                                                   INFO  Authenticated to cluster "milan"                                                                                                                                                                                                                                                  INFO  Outgoing peering activated to the remote cluster "milan"                                                                                                                                                                                                                          INFO  Network established to the remote cluster "milan"                                                                                                                                                                                                                                 INFO  Node created for remote cluster "milan"                                                                                                                                                                                                                                           INFO  Peering successfully established
root@liqo:~/liqo/examples/quick-start# 

现在, Rome集群中的 Liqo 控制平面将联系所提供的身份验证端点,向Milan集群提供令牌以获取其 Kubernetes 身份。

您可以通过运行以下命令来检查对等状态:

root@liqo:~/liqo/examples/quick-start# kubectl get foreignclusters
NAME    TYPE        OUTGOING PEERING   INCOMING PEERING   NETWORKING    AUTHENTICATION   AGE
milan   OutOfBand   Established        None               Established   Established      85s

输出表明跨集群网络隧道已建立,并且传出对等互连当前处于活动状态(即,Rome集群可以将工作负载卸载到Milan集群,但反之则不然):
同时,liqo-milan除了物理节点之外,您还应该看到一个虚拟节点 ( ):

oot@liqo:~/liqo/examples/quick-start# kubectl get nodes
NAME                 STATUS   ROLES           AGE     VERSION
liqo-milan           Ready    agent           2m46s   v1.29.2
rome-control-plane   Ready    control-plane   71m     v1.29.2
rome-worker          Ready    <none>          71m     v1.29.2

此外,您可以使用以下方法检查对等互连状态并检索更多高级信息:

liqoctl status peer milan

部署服务

现在,您可以像在单集群场景中一样在多集群环境中部署标准 Kubernetes 应用程序(即无需修改)。
下一篇见

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/2354.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

基于Python利用zhconv模块进行简繁体字转换

在处理中文文本时&#xff0c;简繁体字之间的转换是一项常见的任务。Python提供了许多库来实现这个目的&#xff0c;其中之一就是zhconv。zhconv是一个Python库&#xff0c;提供了简体字和繁体字之间的转换功能。本教程将向你展示如何使用zhconv模块来实现简繁体字的互转&#…

Redis底层数据结构之Dict

目录 一、概述二、Dict结构三、Dictht结构四、DictEntry结构五、核心特性 上一篇文章 reids底层数据结构之quicklist 一、概述 Redis 的 Dict 是一个高效的键值对映射数据结构&#xff0c;采用双哈希表实现以支持无锁的渐进式 Rehash&#xff0c;确保扩容或缩容时的高效性能。…

想冲宇宙厂,直接挂了。。。

宇宙厂实际是字节&#xff0c;这个称呼是因为字节跳动主宰了宇宙内一切App&#xff0c;有点家大业大的意思。 今天分享一位字节春招凉经&#xff0c;问了一些数据库和Java八股&#xff0c;没出算法题&#xff0c;直接挂了&#xff0c;竟然最喜欢出算法题的字节&#xff0c;这次…

iptables实现docker容器动态端口映射实操

背景 之前在《Docker 动态修改容器端口映射的方法》一文中&#xff0c;说明了如何使用修改配置和加防火墙规则实现动态端口映射。但是没有具体分享加防火墙实现动态端口映射的实际案例。今天就分享一下实际操作案例&#xff0c;供大家参考。 分析 动态端口映射的用途 容器端口…

(2024)Visual Studio的介绍、安装与使用

Visual Studio介绍 1.Visual Studio是什么&#xff1f; Visual Studio是微软公司推出的一款开发工具包系列产品&#xff0c;它是一个基本完整的开发工具集&#xff0c;为软件开发者提供了整个软件生命周期中所需的大部分工具。 2.Visual Studio的定义 Visual Studio是美国微软公…

网盘_游戏_博客自动化部署(Nginx多项目部署)

目录 一.前提介绍 二.环境介绍 三.自述&#xff08;脚本&#xff09; 四.关于Nginx多项目部署 一.前提介绍 在我之前的博客里详细介绍了上述项目的部署&#xff0c;那么如何使用简单脚本自动部署和使用Nginx多项目部署是本文来介绍的基础篇章。 二.环境介绍 CentOS Linux…

fawawf

c语言中的小小白-CSDN博客c语言中的小小白关注算法,c,c语言,贪心算法,链表,mysql,动态规划,后端,线性回归,数据结构,排序算法领域.https://blog.csdn.net/bhbcdxb123?spm1001.2014.3001.5343 给大家分享一句我很喜欢我话&#xff1a; 知不足而奋进&#xff0c;望远山而前行&am…

【Linux】文件目录及路径表示

1. Linux目录结构 在 Linux 系统中&#xff0c;有几个目录是比较重要的&#xff0c;平时需要注意不要误删除或者随意更改内部文件。 /etc&#xff1a; 这个是系统中的配置文件&#xff0c;如果更改了该目录下的某个文件可能会导致系统不能启动。 /bin, /sbin, /usr/bin, /usr…

java泛型介绍

Java 泛型是 JDK 5 引入的一个特性&#xff0c;它允许我们在定义类、接口和方法时使用类型参数&#xff0c;从而使代码更加灵活和类型安全。泛型的主要目的是在编译期提供类型参数&#xff0c;让程序员能够在编译期间就捕获类型错误&#xff0c;而不是在运行时才发现。这样做提…

小程序AI智能名片S2B2C商城系统:解锁内容深耕新境界,助力品牌企业高效定制内容策略

在数字化时代&#xff0c;内容营销已成为品牌企业获取市场份额、增强用户黏性的关键武器。然而&#xff0c;面对海量的互联网信息和复杂多样的社交媒体平台&#xff0c;如何有效地深耕内容&#xff0c;成为众多品牌企业面临的难题。 传统的内容分类与识别方式&#xff0c;往往依…

【数据分析面试】28. 20个Python问答题 (入门级考察:基础操作、数据处理与分析统计)

今天的20个问题考察了 Python 的基础能力&#xff0c;包括数据结构、基本操作、数据处理、数据分析和统计等方面。无论是从事数据分析、机器学习还是其他数据相关工作&#xff0c;这些都是必不可少的基础技能。 数据结构与基础操作&#xff1a; 什么是 Pandas 库&#xff1f;它…

中兴5G随身wifi怎么样?中兴5G随身wifiVS格行5G随身wifi对比测评!公认最好的随身WiFi的格行随身WiFi真实测评!随身WiFi哪个品牌好?

随着各大品牌5G随身wifi的横空出世&#xff0c;其中中兴和格行5G随身wifi的呼声越来越高&#xff0c;那么性能上谁更胜一筹&#xff1f;套餐费用谁更亲民&#xff1f;售后保障谁更到位&#xff1f;今天就来一个全方位测评对比&#xff01; 一&#xff0c;首先是设备的整体外观&…

uniapp:小白1分钟学会使用webSocket(可无脑复制)

uni.connectSocket() uni.$emit页面通信 项目中使用uni.connectSocket()创建webSocket的总结&#xff0c;代码可无脑复制&#xff0c;直接使用。 1、main.js 引入vuex import store from ./store; Vue.prototype.$store store;vuex中封装webSocket 2、vuex的&#xff1a;index…

linux autogroup

一&#xff1a;概述 对于linux autogroup的作用&#xff0c;很多同学可能是听说过&#xff0c;但&#xff0c;并未验证过。 考虑下面场景&#xff0c;开两个terminal&#xff0c;T1和T2&#xff0c;在T1中运行进程P1&#xff0c;P1开启9个线程编译代码&#xff0c;在T2中运行…

yield函数怎么理解?

目录 白话系列&#xff1a; 例子&#x1f330;&#xff1a; 什么叫暂停 yield和next搭配使用 例子&#x1f330;&#xff1a; 白话系列&#xff1a; 可以暂停&#xff0c;可以生成&#xff0c;next一个&#xff0c;yield一个 例子&#x1f330;&#xff1a; def generat…

CUDA线程管理

核函数在主机端启动时&#xff0c;执行会转移到设备上&#xff0c;并且将控制权转移回主机。当核函数在GPU上运行时&#xff0c;主机可以运行其他函数。因此&#xff0c;主机与核函数是异步的。 此时&#xff0c;设备端也就是GPU上会产生大量的线程&#xff0c;并且每个线程都…

(七)小案例银行家应用程序-申请贷款-some方法和every方法

some方法 ● 我们先回顾一下includes方法 console.log(movements.includes(-130));只要数组中存在-130这个值&#xff0c;就会返回true&#xff0c;否则就会返回flase ● 而some方法只要达成某一个条件就会返回true&#xff0c;否则就返回flase const someMethod movement…

stm32开发之threadx之modulex模块文件的生成脚本项目

前言 为了保证在window上运行&#xff0c;且体积小的问题&#xff0c;所以采用c语言编写生成脚本,将相关路径由json文件进行配置,使用了一个cjson库进行解析项目构建使用的是cmake 项目代码 CMakeLists文件 cmake_minimum_required(VERSION 3.27) project(txm_bat_script C…

Day13-Java进阶-IO字节流及其练习题

1. IO流介绍 2. IO 流体系结构 字节流读取纯文本文件会出现乱码问题 2.1 FileOutputStream 字节输出流 package com.itheima.stream.output;import java.io.FileOutputStream; import java.io.IOException;public class FileOutputStreamDemo3 {/*IO流的异常处理方式: jdk7版本…

socket编程——tcp

在我这篇博客&#xff1a;网络——socket编程中介绍了关于socket编程的一些必要的知识&#xff0c;以及介绍了使用套接字在udp协议下如何通信&#xff0c;这篇博客中&#xff0c;我将会介绍如何使用套接字以及tcp协议进行网络通信。 1. 前置准备 在进行编写代码之前&#xff…