首页 > 解决方案 > 我在 GOOGLE KUBERNETS VER 1.19 上安装 WSO2 API MANAGER git hub 上的舵图适用于 kubernetes 1.12 版如何使其工作 1.19

问题描述

我遵循 wso2 API MANAGER ON LIN K 指令https://artifacthub.io/packages/helm/wso2/am-single-node

git clone https://github.com/wso2/kubernetes-apim.git然后更新安装目录上名为 wso2am-gateway-ingress.yaml、wso2am-ingress.yaml 和 wso2am-websub-ingress.yaml 的三个文件~/kubernetes-apim/simple/am-single/templates/am 匹配 nginx 入口控制器与链接https://kubernetes.io/docs/concepts/services-networking /ingress 然后我通过运行代码安装了 WSO2
helm install <RELEASE_NAME> <HELM_HOME>/am-single --version 4.0.0-1 --namespace <NAMESPACE> --dependency-update --create-namespace

代码在G8S Cluster ver1.19上运行成功

但我无法访问服务 请参阅我的链接以访问服务 API Manager Publisher: http: //35.245.157.84/publisher API Manager DevPortal:https ://35.245.157.84/devportal

我做了什么

我使用位于 ~/kubernetes-apim/simple/am 上的三个文件克隆了 WSO2,如下所示

文件 1) wso2am-gateway-ingress.yaml:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: {{ template "am-single-node.resource.prefix" . }}-am-gateway-ingress
  namespace : {{ .Release.Namespace }}
{{- if .Values.wso2.deployment.am.ingress.gateway.annotations }}
  annotations:
{{ toYaml .Values.wso2.deployment.am.ingress.gateway.annotations | indent 4 }}
{{- end }}
spec:
  tls:
  - hosts:
    - {{ .Values.wso2.deployment.am.ingress.gateway.hostname }}
  rules:
  - host: {{ .Values.wso2.deployment.am.ingress.gateway.hostname }}
    http:
      paths:
      - path: /
        backend:
          serviceName: {{ template "am-single-node.resource.prefix" . }}-am-service
          servicePort: 8243

编辑为

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: {{ template "am-single-node.resource.prefix" . }}-am-gateway-ingress
  namespace : {{ .Release.Namespace }}
{{- if .Values.wso2.deployment.am.ingress.gateway.annotations }}
  annotations:
{{ toYaml .Values.wso2.deployment.am.ingress.gateway.annotations | indent 4 }}
{{- end }}
spec:
  tls:
  - hosts:
    - {{ .Values.wso2.deployment.am.ingress.gateway.hostname }}
  rules:
  - host: {{ .Values.wso2.deployment.am.ingress.gateway.hostname }}
    http:
      paths:
      - path: /
        pathType: ImplementationSpecific
        backend:
          service:
            name: {{ template "am-single-node.resource.prefix" . }}-am-service
            port:
              number: 8243

文件 2) wso2am-ingress.yaml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: {{ template "am-single-node.resource.prefix" . }}-am-ingress
  namespace : {{ .Release.Namespace }}
{{- if .Values.wso2.deployment.am.ingress.management.annotations }}
  annotations:
{{ toYaml .Values.wso2.deployment.am.ingress.management.annotations | indent 4 }}
{{- end }}
spec:
  tls:
    - hosts:
        - {{ .Values.wso2.deployment.am.ingress.management.hostname }}
  rules:
    - host: {{ .Values.wso2.deployment.am.ingress.management.hostname }}
      http:
        paths:
          - path: /
            backend:
              serviceName: {{ template "am-single-node.resource.prefix" . }}-am-service
              servicePort: 9443

编辑为

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: {{ template "am-single-node.resource.prefix" . }}-am-ingress
  namespace : {{ .Release.Namespace }}
{{- if .Values.wso2.deployment.am.ingress.management.annotations }}
  annotations:
{{ toYaml .Values.wso2.deployment.am.ingress.management.annotations | indent 4 }}
{{- end }}
spec:
  tls:
    - hosts:
        - {{ .Values.wso2.deployment.am.ingress.management.hostname }}
  rules:
    - host: {{ .Values.wso2.deployment.am.ingress.management.hostname }}
      http:
        paths:
          - path: /
            pathType: ImplementationSpecific
            backend:
              service:
                name: {{ template "am-single-node.resource.prefix" . }}-am-service
                port:
                  number: 9443

文件 3) wso2am-websub-ingress.yaml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: {{ template "am-single-node.resource.prefix" . }}-am-websub-ingress
  namespace : {{ .Release.Namespace }}
{{- if .Values.wso2.deployment.am.ingress.websub.annotations }}
  annotations:
{{ toYaml .Values.wso2.deployment.am.ingress.websub.annotations | indent 4 }}
{{- end }}
spec:
  tls:
  - hosts:
    - {{ .Values.wso2.deployment.am.ingress.websub.hostname }}
  rules:
  - host: {{ .Values.wso2.deployment.am.ingress.websub.hostname }}
    http:
      paths:
      - path: /
        backend:
          serviceName: {{ template "am-single-node.resource.prefix" . }}-am-service
          servicePort: 8021

编辑为

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: {{ template "am-single-node.resource.prefix" . }}-am-websub-ingress
  namespace : {{ .Release.Namespace }}
{{- if .Values.wso2.deployment.am.ingress.websub.annotations }}
  annotations:
{{ toYaml .Values.wso2.deployment.am.ingress.websub.annotations | indent 4 }}
{{- end }}
spec:
  tls:
  - hosts:
    - {{ .Values.wso2.deployment.am.ingress.websub.hostname }}
  rules:
  - host: {{ .Values.wso2.deployment.am.ingress.websub.hostname }}
    http:
      paths:
      - path: /
        pathType: ImplementationSpecific
        backend:
          service:
            name: {{ template "am-single-node.resource.prefix" . }}-am-service
            port:
              number: 8021

请在 LIN K 指令上克隆 wsos API MANAGER https://artifacthub.io/packages/helm/wso2/am-single-node

我通过克隆链接使用 github 上的 wso2 安装

git clone https://github.com/wso2/kubernetes-apim.git

请建议使用 helm ver3 检查我的 helm 图表以在 kubernetes 版本 1.19 上工作

请参阅我的链接以访问服务 API Manager Publisher: http: //35.245.157.84/publisher API Manager DevPortal:https ://35.245.157.84/devportal

看到的输出curl https://am.wso2.com/publisher/ -k

Welcome to Cloud Shell! Type "help" to get started.
Your Cloud Platform project in this session is set to metal-contact-171112.
Use “gcloud config set project [PROJECT_ID]” to change to a different project.
dmalamo42@cs-881542484316-default-default-pc56l:~$ gcloud container clusters get-credentials beanworth-cluster-2 --zone us-east4-a --project metal-contact-171112
Fetching cluster endpoint and auth data.
kubeconfig entry generated for beanworth-cluster-2.
dmalamo42@cs-881542484316-default-default-pc56l:~$ curl https://am.wso2.com/publisher/ -k
curl: (6) Could not resolve host: am.wso2.com
dmalamo42@cs-881542484316-default-default-pc56l:~$ pwd
/home/dmalamo42
dmalamo42@cs-881542484316-default-default-pc56l:~$ sudo nano /etc/hosts
dmalamo42@cs-881542484316-default-default-pc56l:~$ curl https://am.wso2.com/publisher/ -k
<!DOCTYPE html>
<!--
  ~ Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
  ~
  ~ WSO2 Inc. licenses this file to you under the Apache License,
  ~ Version 2.0 (the "License"); you may not use this file except
  ~ in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied.  See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
  -->

<html lang="en">


<head>
    <base href="/publisher/" />
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=1024, initial-scale=1" />
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>[Publisher Portal]WSO2 APIM</title>

    <link href="/publisher/site/public/css/main.css" type="text/css" rel="stylesheet" />
    <link href="/publisher/site/public/css/draftjs.css" type="text/css" rel="stylesheet" />
    <link rel="shortcut icon" href="/publisher/site/public/images/favicon.ico">
</head>

<body>

    <div id="react-root">
        <div class="apim-dual-ring"></div>
    </div>

    <script src="/publisher/site/public/fonts/iconfont/MaterialIcons.js"></script>
    <script src="/publisher/site/public/conf/userThemes.js"></script>
    <script src="/publisher/site/public/conf/portalSettings.js"></script>
    <script src="/publisher/services/settings/settings.js"></script>
    <script src="/publisher/site/public/dist/index.7422e2feefc0de743eb6.bundle.js"></script>
    <!-- Swagger worker has being removed until we resolve
     *              https://github.com/wso2/product-apim/issues/10694 issue, need to change webpack config too -->
    <!--script src="/publisher/"></script-->
    <link rel="stylesheet" href="/publisher/site/public/fonts/iconfont/material-icons.css">
</body>

</html>dmalamo42@cs-881542484316-default-default-pc56l:~$

标签: kubernetesgoogle-cloud-platformwso2kubernetes-helmhelmfile

解决方案


我在kubernetes-apim 文档中找到了:

3. 添加映射主机名和外部 IP 的 DNS 记录

如果定义的主机名(在上一步中)由 DNS 服务支持,请在EXTERNAL-IP相关 DNS 服务中添加映射主机名和外部 IP ( ) 的 DNS 记录。

如果定义的主机名不受 DNS 服务支持,出于评估目的,您可以 /etc/hosts 在客户端的文件中添加一个映射主机名和外部 IP 的条目。

<wso2.deployment.am.ingress.gateway.hostname>

因此,您似乎需要使用自己的域并在values.yaml 文件中设置 Ingress 主机名,或者将 values.yaml 中已经存在的 Ingress 主机名添加到/etc/hosts文件中。


推荐阅读