我是Kubernetes和Kubectl的新手。我基本上是在本地主机上运行GRPC服务器。我想在Mac上使用kubectl在kubernetes上运行的spring boot应用程序中使用此终结点。如果我在application.yml中设置以下配置并在kubernetes中运行,它将无法正常工作。如果我在IDE中运行,则相同的配置有效。
grpc:
client:
local-server:
address: static://localhost:6565
negotiationType: PLAINTEXT
[我看到有人建议使用端口转发,但这是相反的(当我想使用本地主机的kubernetes中已经存在的端口,就像本地主机上的浏览器在kubernetes中运行的tomcat服务器一样)]
apiVersion: apps/v1 kind: Deployment metadata: name: testspringconfigvol labels: app: testspring spec: replicas: 1 selector: matchLabels: app: testspringconfigvol template: metadata: labels: app: testspringconfigvol spec: initContainers: # taken from https://gist.github.com/tallclair/849601a16cebeee581ef2be50c351841 # This container clones the desired git repo to the EmptyDir volume. - name: git-config image: alpine/git # Any image with git will do args: - clone - --single-branch - -- - https://github.com/username/fakeconfig - /repo # Put it in the volume securityContext: runAsUser: 1 # Any non-root user will do. Match to the workload. allowPrivilegeEscalation: false readOnlyRootFilesystem: true volumeMounts: - mountPath: /repo name: git-config containers: - name: testspringconfigvol-cont image: username/testspring ports: - containerPort: 8080 volumeMounts: - mountPath: /usr/local/lib/config/ name: git-config volumes: - name: git-config emptyDir: {}
简单地说,我需要什么:
在我的本地主机中具有某些服务器的端口:localhost
:6565,localhost
:6566,我需要在kubernetes中访问这些端口。那我应该在application.yml config中设置什么呢?是localhost
:6565,localhost
:6566还是how-to-get-this-ip
:6565,how-to-get-this-ip
:6566。
我是Kubernetes和Kubectl的新手。我基本上是在本地主机上运行GRPC服务器。我想在Mac上使用kubectl在kubernetes上运行的spring boot应用程序中使用此终结点。如果我设置了...
1)在application.properties中定义