基于图形化Kube Forwarder工具映射OpenShift

2019-07-30  本文已影响0人  ragpo

痛点描述

1、在访问openshift的应用时,我们一般通过域名的方式进行访问,域名再解析IP至router节点或router的F5节点,解析的方式要么通过本机的DNS server解析,要么通过本机自己配置的hosts解析。
2、当一个开发在本地调试代码时,需要一个mysql环境,在以前要么在本机搭建一个mysql,要么虚拟机部署一个mysql,太慢了,我们可以直接在openshift上部署一个,多方便;当访问类似像mysql这样tcp访问方式的应用是,openshift的router是不支持的(haproxy是可以配置mode从http调整为tcp,但是openshift我还没找到可以配置的地方),那本机就没法访问到mysql了。

解决方案

接下来介绍下解决上诉问题的工具:Kube Forwarder

a

它能够解决啥问题呢?

举个例子,我用openshift的registry-console来说明,正常情况下,我访问registry-console域名是这样的


b

那我用Kube Forwarder来访问,使用本机地址127.0.0.1


c

特点如下

d

使用方法

去官网下载:https://kube-forwarder.pixelpoint.io/
有很多种版本,window,Linux,macOS提供下载。安装后开始演示,我的是macOS,以我的为例。

[root@master01 ~]# cat .kube/config
image.png
[root@master01 ~]# oc get oauthclient
NAME                           SECRET                                                                 WWW-CHALLENGE   TOKEN-MAX-AGE   REDIRECT URIS
cockpit-oauth-client           user6Th43Kdpow3DyN4duWUlWSWskrx7V3D1K4UYmgSX003xaUI5E5iMAXKLgdlxup7n   FALSE           default         https://registry-console-default.ocp311.com
openshift-browser-client       1c69_efAfTo84CMvgqqsKt45XaWuqD2diG3LygJwfvg                            FALSE           default         https://cluster.ocp311.com:8443/oauth/token/display
openshift-challenging-client                                                                          TRUE            default         https://cluster.ocp311.com:8443/oauth/token/implicit
openshift-console              1TY6T42vxacyFDnFSa6HS7pFUhya1AdW                                       FALSE           default         https://console.ocp311.com/
openshift-web-console                                                                                 FALSE           default         https://cluster.ocp311.com:8443/console/
[root@master01 ~]# oc edit oauthclient cockpit-oauth-client
oauthclient.oauth.openshift.io/cockpit-oauth-client edited
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: oauth.openshift.io/v1
kind: OAuthClient
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"oauth.openshift.io/v1","kind":"OAuthClient","metadata":{"annotations":{},"labels":{"createdBy":"registry-console-template"},"name":"cockpit-oauth-client","namespace":"","respondWithChallenges":false},"redirectURIs":["https://registry-console-default.ocp311.com"],"secret":"user6Th43Kdpow3DyN4duWUlWSWskrx7V3D1K4UYmgSX003xaUI5E5iMAXKLgdlxup7n"}
  creationTimestamp: 2019-03-28T15:14:18Z
  labels:
    createdBy: registry-console-template
  name: cockpit-oauth-client
  resourceVersion: "20941760"
  selfLink: /apis/oauth.openshift.io/v1/oauthclients/cockpit-oauth-client
  uid: 2836c416-516c-11e9-a9dd-005056860b09
redirectURIs:
- https://registry-console-default.ocp311.com
- http://127.0.0.1:9000
secret: user6Th43Kdpow3DyN4duWUlWSWskrx7V3D1K4UYmgSX003xaUI5E5iMAXKLgdlxup7n

其他类似的工具

上一篇 下一篇

猜你喜欢

热点阅读