Giter Site home page Giter Site logo

kubernetes-config-map-as-file's Introduction

kubernetes-config-map-as-file inside a pod

  • In this experiment, we're going to request kubernetes to mount a volume with some files.
  • The files will have the content of the config map

Items

  • configmap-app002.yaml
  • app002-pod.yaml

configmap-app002.yaml

It contains non-sensitive information, that a microservice may need for initialization or proper working. It may hold the information about where the microservice is deployed.

app002-pod.yaml

  • It contains a containerized application
  • It has a ssh server
  • As a proof, we can use kubernetes port-forwarding, connect via ssh, and explore the directories of the pod
  • We'll observe the files

Steps

Prepare the container, test locally

  1. Use the command, to start a local docker container with ssh.

docker run --rm -itp 2222:2222 --name=ssh --hostname=ssh -e SUDO_ACCESS=true -e PASSWORD_ACCESS=true -e USER_PASSWORD=dummy -e USER_NAME=dummy linuxserver/openssh-server sh

  1. Now in the localhost machine, try connecting the docker container instance using any SSH client
  2. Tested successfully with "moba" SSH client

Create a pod in kubernetes cluster, test with kubernetes port-forwarding

  1. Use the yaml "configmap-app002.yaml" inside the "Deploy" folder to create a configmap object inside kubernetes cluster

kubectl create -f configmap-app002.yaml

  1. Check and confirm the presence of config map in kubernetes cluster

kubectl get configmaps kubectl describe configmaps/configmap-app002

  1. Create the pod with the docker container using the "app002-pod.yaml" yaml file and confirm its presence

kubectl create -f app002-pod.yaml kubectl get pods

  1. Start the kubernetes port-forwarding

kubectl port-forward pods/mypod 2222:2222

  1. Connect the pod with openssh-server endpoint at localhost:2222 using any SSH client with the credentials dummy:dummy
  2. Explore the files inside the directory /etc/foo

cd /etc/foo ls cat game.properties cat player_initial_lives cat user-interface.properties

References

kubernetes-config-map-as-file's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.