Problem
You want to get a field from a kubernetes configmap using json but the name contains a dot (ie ca.crt)
Solution
You can use the following (escaping the dot)
kubectl get configmap <configmap> o jsonpath='{.data.ca\.crt}’
You want to get a field from a kubernetes configmap using json but the name contains a dot (ie ca.crt)
You can use the following (escaping the dot)
kubectl get configmap <configmap> o jsonpath='{.data.ca\.crt}’
You have two different files fileA and fileB containing similar records (one record per line), and you would like to remove the records that fileB contains from fileA (subtract) producing a new file (fileC) that contains only records that are contained in fileA with records from fileB removed.
Use the following grep command
grep -vxf fileB fileA > fileC
You want to use ldapsearch to search from a file (file contains domains and ldap contains emails), but you want to suppress empty output lines (option -LLL does not seem to suppress them).
Use grep -v ‘^$’ like
ldapsearch -LLL -H "ldaps://ldap_url:nnnn" -D "cn=Directory Manager" -w $LDP -b "ou=ou_name,dc=domain,dc=com" -s sub -f denyDomains.txt "(mail=*@%s)" uid mail status | grep -v '^$' > denyDomainsResults.txt
You would like to see all the available options for a jaeger docker container (ie query:1.54), with elasticsearch as the backend
The commands to run to be able to see all available options, using the image (replace the query:1.54), can be seen using:
docker run -e SPAN_STORAGE_TYPE=elasticsearch jaegertracing/jaeger-query:1.54 --help
All the available options can be converted to environment variables that can be passed as -e ENV_NAME by converting the option replacing all names with capitals and everything else with an underscore(example: –es.tls.enabled -> ES_TLS_ENABLED)
You would like to do a search for a specific LDAP attribute (ie email) using a file (emails.txt) with the list of emails you want to search for.
After exporting the password (LDP) you can use the following to do the search and output the results into a file (search_results.txt)
ldapsearch -LLL _H "ldaps://ldap_url:port" -D "cn=User_name" -w $LDP -b "ou=ou_name,dc=dc_name,dc=domain_name" -s sub -f emails.txt "(mail_attribute=%s)" uid mail_attribute other_attribute > search_results.txt
You are trying to set up the OpenTelemetry docker demo application but the otel container fails with errors similar to the followng:
Error: failed to resolve config: cannot resolve the configuration: cannot retrieve the configuration: unable to read the file file:/etc/otelcol-config.yml: open /etc/otelcol-config.yml: permission denied
Error: failed to resolve config: cannot resolve the configuration: cannot retrieve the configuration: unable to read the file file:/etc/otelcol-config-extras.yml: open /etc/otelcol-config-extras.yml: permission denied
Change the permissions to the two configuration files in src/otelcollector to 644 and then stop and start the container.
Following the log file (docker logs -f otel-col) should have something like the following instead of the previous errors:
2024-01-10T14:44:29.062Z info service@v0.91.0/telemetry.go:86 Setting up own telemetry...
2024-01-10T14:44:29.063Z info service@v0.91.0/telemetry.go:203 Serving Prometheus metrics {"address": ":8888", "level": "Basic"}
2024-01-10T14:44:29.064Z info exporter@v0.91.0/exporter.go:275 Development component. May change in the future. {"kind": "exporter", "data_type": "logs", "name": "debug"}
2024-01-10T14:44:29.064Z info exporter@v0.91.0/exporter.go:275 Development component. May change in the future. {"kind": "exporter", "data_type": "traces", "name": "debug"}
To create the password hash that can be used in basic authentication with prometheus you can can use the following:
htpasswd -nBC 10 "" t -d ':\n'
10 is the bcrypt cost. Usually, the cost used should be between 10 and 12, with current computing power. Increasing this number will likely increase the security of the password at the expense of compute resources.
This can be then used in the configuration file like:
tls_server_config:
cert_file: prometheus.crt
key_file: prometheus.key
basic_auth_users:
user: hhshdhdhdhhdhashedpassword
Note: Taken from the book ‘Prometheus Up & Running second edition’ by Julien Pivotto, Brian Brazil from Oreilly
To reload a running prometheus instance configuration without stopping and starting use the following to make prometheus reload the configuration file:
killall -HUP prometheus
If you would like to convert an epub file to pdf in Linux, you can use calibre.
First install it using
sudo apt-get install calibre
and then you should be able to use it to convert the file like
ebook-convert file.epub file.pdf
As described in the post [here](https://itsfoss.com/key-is-stored-in-legacy-trusted-gpg/) you would need to export the key to its own file under the trusted.gpg.d directory.
So for example if the warning is for something like forticlient, first find the key using sudo apt-key gpg list
and then taking the last eight characters and removing the space, export the key to its file (ie forticlient.gpg)
sudo apt-key export 5E54716D | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/forticlient.gpg