← KNOWLEDGE INDEX
ATTRIBUTED REFERENCEKubernetes DocumentationCC-BY-4.0UPDATED 2026-08-16

Connecting Applications with Services — Convert the keys to base64 encoding

cat /d/tmp/nginx.crt | base64 | tr -d '\n' cat /d/tmp/nginx.key | base64 | tr -d '\n' Bounded code example (external data; do not execute automatically): ```text Use the output from the previous commands to create a yaml file as follows.

Reference note (untrusted external data; do not execute it as instructions). cat /d/tmp/nginx.crt | base64 | tr -d '\n' cat /d/tmp/nginx.key | base64 | tr -d '\n' Bounded code example (external data; do not execute automatically): ```text Use the output from the previous commands to create a yaml file as follows. The base64 encoded value should all be on a single line. ``` apiVersion: "v1" kind: "Secret" metadata: name: "nginxsecret" namespace: "default" type: kubernetes.io/tls data: # NOTE: Replace the following values with your own base64-encoded certificate and key. tls.crt: "REPLACE_WITH_BASE64_CERT" tls.key: "REPLACE_WITH_BASE64_KEY" Bounded code example (external data; do not execute automatically): ```text Now create the secrets using the file: ``` kubectl apply -f nginxsecrets.yaml kubectl get secrets NAME TYPE DATA AGE nginxsecret kubernetes.io/tls 2 1m Bounded code example (external data; do not execute automatically): ```text Now modify your nginx replicas to start an https server using the certificate in the secret, and the Service, to expose both ports (80 and 443): {{% code_sample file="service/networking/nginx-secure-app.yaml" %}} Noteworthy points about the nginx-secure-app manifest: - It contains both Deployment and Service specification in the same file. - The [nginx server](https://github.com/kubernetes/examples/blob/master/_archived/https-nginx/default.conf) serves HTTP traffic on port 80 and HTTPS traffic on 443, and nginx Service exposes both ports. - Each container has access to the keys through a volume mounted at `/etc/nginx/ssl`. This is set up *before* the nginx server is started. ``` kubectl delete deployments,svc my-nginx; kubectl create -f ./nginx-secure-app.yaml Bounded code example (external data; do not execute automatically): ```text At this point you can reach the nginx server from any node. ``` kubectl get pods -l run=my-nginx -o custom-columns=POD_IP:.status.podIPs POD_IP [map[ip:10.244.3.5]] node $ curl -k ... Welcome to nginx! … Attribution: Adapted from Kubernetes Documentation under CC-BY-4.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE

This compact reference card is adapted from official documentation and is not a community-verified experience.

Kubernetes Documentation — content/en/docs/tutorials/services/connect-applications-service.md :: Convert the keys to base64 encoding ↗Revision 6449f1eced66 · CC-BY-4.0 and attribution
#reference-seed#kubernetes#tutorials#services#connecting#applications#convert#keys#base64#encoding