SCDF пытается подключиться к localhost: 8888 при чтении свойств через config-server - PullRequest
0 голосов
/ 19 июня 2020

Я использую специально созданный сервер SCDF на платформе openshift. Я использую сервер конфигурации для чтения свойств из репозитория конфигурации. SCDF может подключиться к серверу конфигурации с правильным доменным именем, например «wwww.config-server-properties.com», и прочитать свойства. Но как только сервер запустился, scdf снова начал постоянно искать ресурсы конфигурации на localhost: 8888. Я попытался переключить свойство scdf.cloud.config.server.enabled как в deployment.yaml из scdf, так и в моем специально созданном проекте scdf. Я не знаю, откуда scdf на самом деле относится к localhost: 8888. Подробности ниже.

Logs:
```
 INFO 1 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://config-server-batchadmin.dvos.capella.edu 
 INFO 1 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=batchAdmin, profiles=[kubernetes], label=null, version=bc0cbea28354151cd8a3a43213cbeaf6c6e0ff7a, state=null
 INFO 1 --- [           main] b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource {name='bootstrapProperties-configClient'}, BootstrapPropertySource {name='bootstrapProperties-https://gitlab.capella.edu/courseroom/sei-configsecrets.git/src/main/resources/batchAdmin.properties' }]
 INFO 1 --- [           main] b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource {name='bootstrapProperties-secrets.spring-cloud-dataflow-server.batchadmin'}]
[main] INFO  edu.capella.batchadmin.CustomDataflowServerApplication.logStartupProfileInfo - The following profiles are active: kubernetes
[main] INFO  org.springframework.data.repository.config.RepositoryConfigurationDelegate.multipleStoresDetected - Multiple Spring Data modules found, entering strict repository configuration mode!
[main] INFO  org.springframework.data.repository.config.RepositoryConfigurationDelegate.registerRepositoriesIn - Bootstrapping Spring Data Map repositories in DEFAULT mode.
[main] INFO  org.springframework.data.repository.config.RepositoryConfigurationDelegate.registerRepositoriesIn - Finished Spring Data repository scanning in 516ms. Found 1 Map repository interbatches.
[main] INFO  org.springframework.data.repository.config.RepositoryConfigurationDelegate.multipleStoresDetected - Multiple Spring Data modules found, entering strict repository configuration mode!

REPETITIVE CALLS
****************
[http-nio-80-exec-4] INFO  org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.getRemoteEnvironment - Fetching config from server at : http://localhost:8888 
[http-nio-80-exec-4] INFO  org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.getRemoteEnvironment - Connect Timeout Exception on Url - http://localhost:8888 . Will be trying the next url if available
[http-nio-80-exec-4] WARN  org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate - Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/batchAdmin/kubernetes":  Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused)
[http-nio-80-exec-7] INFO  org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.getRemoteEnvironment - Fetching config from server at : http://localhost:8888 
[http-nio-80-exec-4] INFO  org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.getRemoteEnvironment - Connect Timeout Exception on Url - http://localhost:8888 . Will be trying the next url if available
[http-nio-80-exec-4] WARN  org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate - Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/batchAdmin/kubernetes":  Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused)
```

scdf-deployment.yaml - config client
------------------------------------
```
apiVersion: apps/v1
kind: Deployment
metadata:
  name: scdf-server
  labels:
    app: scdf-server
spec:
  selector:
    matchLabels:
      app: scdf-server
  replicas: 1
  template:
    metadata:
      labels:
        app: scdf-server
    spec:
      containers:
      - name: scdf-server
        image: docker-registry.default.svc:5000/batchadmin/scdf-server
        imagePullPolicy: Always
        ports:
        - containerPort: 80
        resources:
          limits:
            cpu: 1.0
            memory: 2048Mi
          requests:
            cpu: 0.5
            memory: 1024Mi
        env:
        - name: KUBERNETES_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: "metadata.namespace"
        - name: SERVER_PORT
          value: '80'
        - name: SPRING_CLOUD_CONFIG_ENABLED
          value: 'true'
        - name: SPRING_CLOUD_KUBERNETES_CONFIG_ENABLE_API
          value: 'false'
      serviceAccountName: scdf-sa
```
bootstrap.properties - client
----------------------------
```
spring.cloud.config.name=batchAdmin
spring.cloud.config.uri=http://config-server-batchadmin.example.edu
#spring.cloud.config.label=master
#spring.cloud.config.enabled=false
```
application.properties - server
-------------------------------
spring.cloud.config.server.git.uri=https://gitlab.example.com/config/configsecrets.git
spring.cloud.config.server.git.username=username
spring.cloud.config.server.git.password=password
spring.cloud.config.server.git.skip-ssl-validation=true
spring.cloud.config.server.git.search-paths=src/main/resources

deployment.yaml - server
------------------------
```
apiVersion: apps/v1
kind: Deployment
metadata:
  name: config-server
  labels:
    app: config-server
spec:
  selector:
    matchLabels:
      app: config-server
  replicas: 1
  template:
    metadata:
      labels:
        app: config-server
    spec:
      containers:
      - name: scdf-server
        image: docker-registry.default.svc:5000/facadmin/config-server
        imagePullPolicy: Always
        ports:
        - containerPort: 80
        resources:
          limits:
            cpu: 1.0
            memory: 2048Mi
          requests:
            cpu: 0.5
            memory: 1024Mi
        env:
        - name: KUBERNETES_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: "metadata.namespace"
        - name: SERVER_PORT
          value: '80'
      serviceAccountName: scdf-sa
```
Is there anyother config setting missing? Where I went wrong ?
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...