consul-template | Template rendering , notifier , and supervisor for @ | Configuration Management library
kandi X-RAY | consul-template Summary
kandi X-RAY | consul-template Summary
This project provides a convenient way to populate values from Consul into the file system using the consul-template daemon. The daemon consul-template queries a Consul or Vault cluster and updates any number of specified templates on the file system. As an added bonus, it can optionally run arbitrary commands when the update process completes. Please see the examples folder for some scenarios where this functionality might prove useful.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of consul-template
consul-template Key Features
consul-template Examples and Code Snippets
Community Discussions
Trending Discussions on consul-template
QUESTION
I'm using consul, consul-template and nginx on docker. When adding each new service, i have to change consul-template source file again. By the way all we're using soap services and proxy. All of them have service uri. How can i write nginx.ctmpl ? example web service end point :
...ANSWER
Answered 2022-Mar-15 at 23:13This should do what you want.
Given the following service config:
QUESTION
I have a consul server running on https://dev.example.com/ on which I store configurations as below:
consul key name = dev
consul key value = some yaml data
kubernetes configMap value some yaml data
--> ( this is in sync with consul data )
what I want to do is as soon as I change something in some yaml data
, the values should be automatically reflected in configMap and pod should be reloaded automatically to capture new values.
I have tried envconsul
but it only picks keys with one value.
I tried consul-template
but did not find any good working example.
ANSWER
Answered 2022-Mar-07 at 23:54Take a look at https://github.com/Trendyol/trendyol-consul-template-injector. It allows you to inject consul-template as a sidecar to your pod, and will generate files from templates that are provided in a ConfigMap. Your application will need to monitor this generated file, and reload itself when the file changes.
See https://medium.com/trendyol-tech/configuration-and-secret-management-with-consul-template-on-kubernetes-dcc4c6695142 for a more detailed blog post explaining why this was built and how it works.
QUESTION
I am very new to consul. I just want to load my environment variables from consul kv using consul-template. I have an consul kv entry having key "iamdbusername". I want to assign its value in an environment variable IAM_DB_USER with the help of consul-template. My application is using the environment variable IAM_DB_USER for getting the database user name.
Any clue in this will be very helpful for me.
Thanks!!!
...ANSWER
Answered 2021-Jul-12 at 18:41envconsul can be used to launch a subprocess with environment variables that are populated from Consul.
https://stackoverflow.com/a/67888502/12384224 provides an example of launching a process with envconsul, as well as with an additional tool called Teller.
QUESTION
I'm trying to figure out which tools from GKE stack I should apply to my use case which is a dynamic deployment of stateful application with dynamic HTTP endpoints.
Stateful in my case means that I don't want any replicas and load-balancing (because the app doesn't scale horizontally at all). I understand though that in k8s/gke nomenclature I'm still going to be using a 'load-balancer' even though it'll act as a reverse proxy and not actually balance any load.
The use case is as follows. I have some web app where I can request for a 'new instance' and in return I get a dynamically generated url (e.g. http://random-uuid-1.acme.io). This domain should point to a newly spawned, single instance of a container (Pod) hosting some web application. Again, if I request another 'new instance', I'll get a http://random-uuid-2.acme.io which will point to another (separate), newly spawned instance of the same app.
So far I figured out following setup. Every time I request a 'new instance' I do the following:
- create a new Pod with dynamic name
app-${uuid}
that exposes HTTP port - create a new Service with NodePort that "exposes" the Pod's HTTP port to the Cluster
- create or update (if exists) Ingress by adding a new http rule where I specify that domain X should point at NodePort X
The Ingress mentioned above uses a LoadBalancer as its controller, which is automated process in GKE.
A few issues that I've already encountered which you might be able to help me out with:
- While Pod and NodePort are separate resources per each app, Ingress is shared. I am thus not able to just create/delete a resource but I'm also forced to keep track of what has been added to the Ingress to be then able to append/delete from the yaml which is definitely not the way to do that (i.e. editing yamls). Instead I'd probably want to have something like an Ingress to monitor a specific namespace and create rules automatically based on Pod labels. Say I have 3 pods with labels,
app-1
,app-2
andapp-3
and I want Ingress to automatically monitor all Pods in my namespace and create rules based on the labels of these pods (i.e. app-1.acme.io -> reverse proxy to Podapp-1
). - Updating Ingress with a new HTTP rule takes around a minute to allow traffic into the Pod, until then I keep getting 404 even though both Ingress and LoadBalancer look as 'ready'. I can't figure out what I should watch/wait for to get a clear message that the Ingress Controller is ready for accepting traffic for newly spawned app.
- What would be the good practice of managing such cluster where you can't strictly define Pods/Services manifests because you are creating them dynamically (with different names, endpoints or rules). You surely don't want to create bunch of yaml-s for every application you spawn to maintain. I would imagine something similar to consul templates in case of Consul but for k8s?
ANSWER
Answered 2021-Jul-05 at 19:46I participated in a similar project and our decision was to use Kubernetes Client Library to spawn instances. The instances were managed by a simple web application, which took some customisation parameters, saved them into its database, then created an instance. Because of the database, there was no problem with keeping track of what have been created so far. By querying the database we were able to tell if such deployment was already created or update/delete any associated resources.
Each instance consisted of:
- a deployment (single or multi-replica, depending on the instance);
- a
ClusterIp
service (no reason to reserve machine port withNodePort
); - an ingress object for shared ingress controller;
- and some shared configMaps.
And we also used external DNS and cert manager, one to manage DNS records and another to issue SSL certificates for the ingress. With this setup it took about 10 minutes to deploy a new instance. The pod and ingress controller were ready in seconds but we had to wait for the certificate and it's readiness depended on whether issuer's DNS got our new record. This problem might be avoided by using a wildcard domain but we had to use many different domains so it wasn't an option in our case.
Other than that you might consider writing a Helm chart and make use of helm list
command to find existing instances and manage them. Though, this is a rather 'manual' solution. If you want this functionality to be a part of your application - better use a client library for Kubernetes.
QUESTION
I have a react app that I want to deploy to kubernetes using a docker file and host it using nginx. My Dockerfile looks like this
...ANSWER
Answered 2021-Jun-24 at 08:14Few notes on the above :
1: I'd use multistage Dockerfile build, where your whole build process happens in the node container but the final, complete, built application is then copied into an nginx based container like
QUESTION
I've just inherited an Nginx proxy/app server setup that makes use of Consul and Consul Template for service discovery and registration. The Nginx proxy has a config file with an entry like this to register the downstream app servers:
...ANSWER
Answered 2020-Dec-12 at 20:02You can achieve this by storing the result of the service
lookup in a variable, then using a conditional that only outputs the upstream block if the variable is not empty.
QUESTION
We have an nginx conf file that is being produced with consul-template for 2000+ services, running Consul 1.6.1.
We're trying to upgrade to Consul 1.7.2 and running into an issue where consul-template DDoSes Consul node agent.
Node/client agent v1.6.1 works fine, but node/client agent v1.7.2 starts refusing connections from consul-template.
The template in question (simplified version) is:
...ANSWER
Answered 2020-May-04 at 17:28The http_max_conns_per_client
parameter was introduced in hashicorp/consul#7159 to address CVE-2020-7219. The default value of 200 seemed to be a reasonable default for most use cases. However, there are scenarios such as yours where it makes sense to raise this value.
The only downside to raising this is that any client which is able to communicate with the Consul API will be able to create up to 5000 connections. It is not possible to raise this limit only for a specific client. Keep that in mind as you push these changes to production.
QUESTION
My Kubernetes Deployment is composed like this:
...ANSWER
Answered 2020-Feb-18 at 18:13As anmol said in the comments, it was indeed the fact of binding a single file using subPath
in the directory.
The solution was to remove the subPath and bind the shared-data
volume into a single-scoped folder (ie. /usr/src/app/credentials
) so that it won't go wrong with other things.
Solution:
QUESTION
can someone tell me the error in the Dockerfile given below: I am trying to follow instructions given in this repo: https://github.com/anthcourtney/docker-consul-template-haproxy
...ANSWER
Answered 2020-Jan-30 at 19:22Problem here is with the alpine image version, try it using the latest tag or any other tag latest py-pip is compatible with.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install consul-template
Download a pre-compiled, released version from the Consul Template releases page.
Extract the binary using unzip or tar.
Move the binary into $PATH.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page