Ignite-Kubernetes集成中的异常

时间:2018-12-11 12:02:22

标签: kubernetes ignite

我是Ignite和Kubernetes的新手。

尝试将Ignite版本2.6.0数据网格应用程序集成到AKS中。 客户端jar文件位于VM中,其中已公开kubectl。按照以下网址,使用kubectl在客户端jar VM中执行了所有.yaml文件

https://apacheignite.readme.io/docs/stateful-deployment

可以从存在客户端jar的VM远程登录Kubernetes集群的主URL。

如下所述,

ignite-stateful-set.yaml配置为“ example-kube-persistence.xml”。 -名称:selfLink           值:file:///opt/example-kube-persistence.xml

Ignite客户端正在读取配置,例如... 试试(Ignite ignite = Ignition.start(“ / opt / apache-ignite-fabric-2.6.0-bin / examples / config / example-ignite.xml”))

example-ignite.xml配置...

<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.kubernetes.TcpDiscoveryKubernetesIpFinder">
                <property name="namespace" value="ignite"/>
                <property name="serviceName" value="ignite"/>

                                   <property name="masterUrl" value="https://xxxxxxxxx.azmk8s.io:443"/>
                                   <property name="AccountToken" value="/data/ignite"/>

                </bean>

开始运行客户端并收到以下异常...

 class org.apache.ignite.spi.IgniteSpiException: Failed to retrieve Ignite pods IP addresses.
    at org.apache.ignite.spi.discovery.tcp.ipfinder.kubernetes.TcpDiscoveryKubernetesIpFinder.getRegisteredAddresses(TcpDiscoveryKubernetesIpFinder.java:172)
    at org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.registeredAddresses(TcpDiscoverySpi.java:1828)
    at org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.resolvedAddresses(TcpDiscoverySpi.java:1776)
    at org.apache.ignite.spi.discovery.tcp.ServerImpl.sendJoinRequestMessage(ServerImpl.java:1029)
    at org.apache.ignite.spi.discovery.tcp.ServerImpl.joinTopology(ServerImpl.java:890)
    at org.apache.ignite.spi.discovery.tcp.ServerImpl.spiStart(ServerImpl.java:373)
    at org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.spiStart(TcpDiscoverySpi.java:1948)
    at org.apache.ignite.internal.managers.GridManagerAdapter.startSpi(GridManagerAdapter.java:297)
    at org.apache.ignite.internal.managers.discovery.GridDiscoveryManager.start(GridDiscoveryManager.java:915)
    at org.apache.ignite.internal.IgniteKernal.startManager(IgniteKernal.java:1721)
    at org.apache.ignite.internal.IgniteKernal.start(IgniteKernal.java:1028)
    at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start0(IgnitionEx.java:2014)
    at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start(IgnitionEx.java:1723)
    at org.apache.ignite.internal.IgnitionEx.start0(IgnitionEx.java:1151)
    at org.apache.ignite.internal.IgnitionEx.startConfigurations(IgnitionEx.java:1069)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:955)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:854)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:724)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:693)
    at org.apache.ignite.Ignition.start(Ignition.java:352)
    at com.ecoenergy.cortix.ignite.IgniteFutureAsync.main(IgniteFutureAsync.java:54)
Caused by: class org.apache.ignite.spi.IgniteSpiException: Failed to load services account token [setAccountToken= /var/run/secrets/kubernetes.io/serviceaccount/token]
    at org.apache.ignite.spi.discovery.tcp.ipfinder.kubernetes.TcpDiscoveryKubernetesIpFinder.serviceAccountToken(TcpDiscoveryKubernetesIpFinder.java:287)
    at org.apache.ignite.spi.discovery.tcp.ipfinder.kubernetes.TcpDiscoveryKubernetesIpFinder.getRegisteredAddresses(TcpDiscoveryKubernetesIpFinder.java:148)
    ... 20 more
Caused by: java.nio.file.NoSuchFileException: /var/run/secrets/kubernetes.io/serviceaccount/token
    at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
    at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
    at java.nio.file.Files.newByteChannel(Files.java:361)
    at java.nio.file.Files.newByteChannel(Files.java:407)
    at java.nio.file.Files.readAllBytes(Files.java:3152)
    at org.apache.ignite.spi.discovery.tcp.ipfinder.kubernetes.TcpDiscoveryKubernetesIpFinder.serviceAccountToken(TcpDiscoveryKubernetesIpFinder.java:285)
    ... 21 more

请帮助我摆脱异常。预先感谢。

1 个答案:

答案 0 :(得分:0)

它正在/var/run/secrets/kubernetes.io/serviceaccount/token中寻找服务帐户令牌,但是该文件不存在。问题是为什么?

一些命令:

kubectl get serviceaccounts

您应该找到一个叫做“点燃”的东西。如果没有,那是你的问题。

kubectl get serviceaccounts/ignite -o yaml

如果有一个名为automountServiceAccountToken的属性设置为false,那就是您的问题。

应在底部列出机密信息。如果没有,那是你的问题。

kubectl get secrets/default-token-wnfp5 -o yaml

(显然用您的秘密名称替换。)

您应该在输出中找到一个令牌。

kubectl get pods
kubectl get pods/ignite-0 -o yaml

您正在寻找秘密的本地名称。然后,在文件的后面,将其挂载。如果未安装,那就是您的问题。如果它指向一个奇怪的地方,那就是您的问题。

另外,看看:

kubectl get clusterrolebinding/ignite

Roleref和主体都应指向明智的价值观。

Kubernetes的间接访问级别如此之多,以至于容易错过某个地方的链接。如果您没有意外错过任何步骤(或者有一些Azure怪癖),也可以查看service account documentation