Skip to content

Commit fedba48

Browse files
authored
Update patterns.md
1 parent 94a8bde commit fedba48

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

content/patterns.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ Passing configuration data through environment variables can be an option. Howev
933933
### Configuration Templates
934934
Config Maps and Secrets are a common way of passing configurations data to containerized applications. Sometimes, however, these configuration data are only available at the starting time and cannot be placed into static configuration maps or secrets. In such cases, configuration data can be placed into Configuration Templates and processed before the startup of the container, for example by a dedicated Init Container.
935935
936-
In the following example, we're going to create a distributed data store cluster based on Consul. This cluster, requires a minimum of three pods running a Consul server. The cluster is made when each server instance can connect togheter. For this example, we're going to use a Steful Set controller because this is the natural choiche of kuberentes to run distributed stateful applications.
936+
In the following example, we're going to create a distributed data store cluster based on Consul. This cluster, requires a minimum of three pods running a Consul server. The cluster is made when each server instance can connect togheter. For this example, we're going to use a Steful Set controller because this is the natural choice run distributed stateful applications in kubernetes.
937937
938938
The configuration template we're using to setup the Consul cluster is the following ``consul.json`` file
939939
@@ -952,7 +952,7 @@ The configuration template we're using to setup the Consul cluster is the follow
952952
}
953953
```
954954

955-
The template above contains the ``retry_join`` property. The value for this property must be the list of the three consul server names required to form the cluster. Unfortunately, these names are not known in advance, because they depend on the namespaces where the pods are running. For this reason, we put a placeholder ``consul.default.svc.cluster.local`` and use an init container to change the placeholder before the main consul container server starts.
955+
The template above contains the ``retry_join`` property. The value for this property must be the list of all the three server names required to form the cluster. Unfortunately, these names are not known in advance, because they depend on the namespace where the pods are running. For this reason, we put a placeholder ``consul.default.svc.cluster.local`` and use an init container to change the placeholder with the real name before the main container starts.
956956

957957
The following snippet reports the init container and the main container
958958

@@ -1000,14 +1000,14 @@ The following snippet reports the init container and the main container
10001000
...
10011001
```
10021002

1003-
The init container implements a simple configuration template processor based on unix ``sed`` utility. In addition to the init and the main containers, this pod also defines two volumes: one volume for the configuration template, backed by a config map. The other volume is an empty shared volume which is used to share the processed templates between the init container and the main container.
1003+
The init container implements a simple configuration template processor based on the Unix ``sed`` utility. In addition to the init and the main container, this pod also defines two volumes: one volume for the configuration template, backed by a config map. The other volume is an empty shared volume which is used to share the processed data between the init container and the main container.
10041004

10051005
With this setup, the following steps are performed during startup of this pod:
10061006

10071007
1. The init container starts and gathers the namespace from the API server
10081008
2. The init container reads the configuration template from mounted config map volume and runs the processor
10091009
3. The processor changes the placeholder with the real namespace and stores the result into the empty shared volume
1010-
4. The init container exits after it has finished leaving the real configuration file into the shared volume
1010+
4. The init container exits after it has finished leaving the real configuration into the shared volume
10111011
5. The main consul container starts and loads the configuration file from the shared volume
10121012

10131013
The complete example can be found [here](./stateful.md).

0 commit comments

Comments
 (0)