Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Kibana 8.11.2 and secure settings #7371

Closed
thbkrkr opened this issue Dec 8, 2023 · 1 comment
Closed

Issue with Kibana 8.11.2 and secure settings #7371

thbkrkr opened this issue Dec 8, 2023 · 1 comment
Labels
>bug Something isn't working

Comments

@thbkrkr
Copy link
Contributor

thbkrkr commented Dec 8, 2023

Issue

Kibana 8.11.2 introduced a breaking change that makes it unusable when configured with secure settings for all ECK versions.

See:

To reproduce:

apiVersion: kibana.k8s.elastic.co/v1
kind: Kibana
metadata:
  name: test
spec:
  secureSettings:
  - secretName: one-secure-settings-secret
  version: 8.11.2
  count: 1
  elasticsearchRef:
    name: test

Pod gets status Init:Error:

> k get po -l common.k8s.elastic.co/type=kibana
pod/n-kb-67b849f78f-2wtkz   0/1     Init:Error         2 (27s ago)     49s

Pod logs:

> k logs test-kb-67b849f78f-2wtkz -c elastic-internal-init-keystore
+ keystore_initialized_flag=/usr/share/kibana/config/elastic-internal-init-keystore.ok
+ [[ -f /usr/share/kibana/config/elastic-internal-init-keystore.ok ]]
+ echo 'Initializing keystore.'
+ /usr/share/kibana/bin/kibana-keystore create
Initializing keystore.
Error: ENOENT: no such file or directory, open '/usr/share/kibana/config/kibana.yml'
    at Object.openSync (node:fs:603:3)
    at readFileSync (node:fs:471:35)
    at readYaml (/usr/share/kibana/node_modules/@kbn/config/src/raw/read_config.js:20:69)
    at getConfigFromFiles (/usr/share/kibana/node_modules/@kbn/config/src/raw/read_config.js:56:18)
    at buildDataPaths (/usr/share/kibana/node_modules/@kbn/utils/src/path/index.js:41:82)
    at getDataPath (/usr/share/kibana/node_modules/@kbn/utils/src/path/index.js:71:36)
    at getKeystore (/usr/share/kibana/src/cli/keystore/get_keystore.js:21:63)
    at Object.<anonymous> (/usr/share/kibana/src/cli_keystore/cli_keystore.js:25:71)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1310:10)

Workaround

Explicitely mount kibana.yml from the elastic-internal-kibana-config volume:

apiVersion: kibana.k8s.elastic.co/v1
kind: Kibana
metadata:
  name: test
spec:
  secureSettings:
  - secretName: one-secure-settings-secret
  version: 8.11.2
  count: 1
  elasticsearchRef:
    name: test
  # --------------------------------------------------
  podTemplate:
    spec:
      initContainers:
      - name: elastic-internal-init-keystore
        volumeMounts:
        - mountPath: /usr/share/kibana/config/kibana.yml
          name: elastic-internal-kibana-config
          readonly: true
          subPath: kibana.yml
  # --------------------------------------------------

Long-term solution

Upgrade directly to 8.11.3 (which is not out as I write this but will be very soon).

@thbkrkr thbkrkr added the >bug Something isn't working label Dec 8, 2023
@thbkrkr thbkrkr changed the title Issue with Kibana 8.11.2 with secure settings Issue with Kibana 8.11.2 and secure settings Dec 8, 2023
@thbkrkr
Copy link
Contributor Author

thbkrkr commented Dec 8, 2023

To create secure settings, ECK calls the Kibana keystore binary in an init container. Why there is no config.yaml in this init container? It's related to its volumes.

# pod volumes
{
  "emptyDir": {},
  "name": "elastic-internal-kibana-config-local"
},
{
  "name": "elastic-internal-kibana-config",
  "secret": {
    "defaultMode": 420,
    "optional": false,
    "secretName": "n-kb-config"
  }
}
# init container volumeMounts
 {
    "mountPath": "/mnt/elastic-internal/kibana-config",
    "name": "elastic-internal-kibana-config",
    "readOnly": true
  },
  {
    "mountPath": "/usr/share/kibana/config",
    "name": "elastic-internal-kibana-config-local"
  }

// ConfigSharedVolume contains the Kibana config/ directory, it's an empty volume where the required configuration
// is initialized by the elastic-internal-init-config init container. Its content is then shared by the init container
// that creates the keystore and the main Kibana container.
// This is needed in order to have in a same directory both the generated configuration and the keystore file which
// is created in /usr/share/kibana/config since Kibana 7.9

More details:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant