Skip to content

Commit 177c1ec

Browse files
authored
Create Flux_Install_Yaml.md
1 parent 818608c commit 177c1ec

File tree

1 file changed

+271
-0
lines changed

1 file changed

+271
-0
lines changed

docs/Flux_Install_Yaml.md

Lines changed: 271 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,271 @@
1+
---
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: flux-git-deploy
6+
namespace: flux
7+
type: Opaque
8+
---
9+
# memcached deployment used by Flux to cache
10+
# container image metadata.
11+
apiVersion: apps/v1
12+
kind: Deployment
13+
metadata:
14+
name: memcached
15+
namespace: flux
16+
spec:
17+
replicas: 1
18+
selector:
19+
matchLabels:
20+
name: memcached
21+
template:
22+
metadata:
23+
labels:
24+
name: memcached
25+
spec:
26+
containers:
27+
- name: memcached
28+
image: memcached:1.5.15
29+
imagePullPolicy: IfNotPresent
30+
args:
31+
- -m 512 # Maximum memory to use, in megabytes
32+
- -I 5m # Maximum size for one item
33+
- -p 11211 # Default port
34+
# - -vv # Uncomment to get logs of each request and response.
35+
ports:
36+
- name: clients
37+
containerPort: 11211
38+
securityContext:
39+
runAsUser: 11211
40+
runAsGroup: 11211
41+
allowPrivilegeEscalation: false
42+
---
43+
apiVersion: v1
44+
kind: Service
45+
metadata:
46+
name: memcached
47+
namespace: flux
48+
spec:
49+
ports:
50+
- name: memcached
51+
port: 11211
52+
selector:
53+
name: memcached
54+
---
55+
# The service account, cluster roles, and cluster role binding are
56+
# only needed for Kubernetes with role-based access control (RBAC).
57+
apiVersion: v1
58+
kind: ServiceAccount
59+
metadata:
60+
labels:
61+
name: flux
62+
name: flux
63+
namespace: flux
64+
---
65+
apiVersion: rbac.authorization.k8s.io/v1beta1
66+
kind: ClusterRole
67+
metadata:
68+
labels:
69+
name: flux
70+
name: flux
71+
rules:
72+
- apiGroups: ['*']
73+
resources: ['*']
74+
verbs: ['*']
75+
- nonResourceURLs: ['*']
76+
verbs: ['*']
77+
---
78+
apiVersion: rbac.authorization.k8s.io/v1beta1
79+
kind: ClusterRoleBinding
80+
metadata:
81+
labels:
82+
name: flux
83+
name: flux
84+
roleRef:
85+
apiGroup: rbac.authorization.k8s.io
86+
kind: ClusterRole
87+
name: flux
88+
subjects:
89+
- kind: ServiceAccount
90+
name: flux
91+
namespace: flux
92+
---
93+
apiVersion: apps/v1
94+
kind: Deployment
95+
metadata:
96+
name: flux
97+
namespace: flux
98+
spec:
99+
replicas: 1
100+
selector:
101+
matchLabels:
102+
name: flux
103+
strategy:
104+
type: Recreate
105+
template:
106+
metadata:
107+
annotations:
108+
prometheus.io/port: "3031" # tell prometheus to scrape /metrics endpoint's port.
109+
labels:
110+
name: flux
111+
spec:
112+
serviceAccountName: flux
113+
volumes:
114+
- name: git-key
115+
secret:
116+
secretName: flux-git-deploy
117+
defaultMode: 0400 # when mounted read-only, we won't be able to chmod
118+
119+
# This is a tmpfs used for generating SSH keys. In K8s >= 1.10,
120+
# mounted secrets are read-only, so we need a separate volume we
121+
# can write to.
122+
- name: git-keygen
123+
emptyDir:
124+
medium: Memory
125+
126+
# The following volume is for using a customised known_hosts
127+
# file, which you will need to do if you host your own git
128+
# repo rather than using github or the like. You'll also need to
129+
# mount it into the container, below. See
130+
# https://docs.fluxcd.io/en/latest/guides/use-private-git-host.html
131+
# - name: ssh-config
132+
# configMap:
133+
# name: flux-ssh-config
134+
135+
# The following volume is for using a customised .kube/config,
136+
# which you will need to do if you wish to have a different
137+
# default namespace. You will also need to provide the configmap
138+
# with an entry for `config`, and uncomment the volumeMount and
139+
# env entries below.
140+
# - name: kubeconfig
141+
# configMap:
142+
# name: flux-kubeconfig
143+
144+
# The following volume is used to import GPG keys (for signing
145+
# and verification purposes). You will also need to provide the
146+
# secret with the keys, and uncomment the volumeMount and args
147+
# below.
148+
# - name: gpg-keys
149+
# secret:
150+
# secretName: flux-gpg-keys
151+
# defaultMode: 0400
152+
153+
containers:
154+
- name: flux
155+
# There are no ":latest" images for flux. Find the most recent
156+
# release or image version at https://hub.docker.com/r/fluxcd/flux/tags
157+
# and replace the tag here.
158+
image: docker.io/fluxcd/flux:1.16.0
159+
imagePullPolicy: IfNotPresent
160+
resources:
161+
requests:
162+
cpu: 50m
163+
memory: 64Mi
164+
ports:
165+
- containerPort: 3030 # informational
166+
livenessProbe:
167+
httpGet:
168+
port: 3030
169+
path: /api/flux/v6/identity.pub
170+
initialDelaySeconds: 5
171+
timeoutSeconds: 5
172+
readinessProbe:
173+
httpGet:
174+
port: 3030
175+
path: /api/flux/v6/identity.pub
176+
initialDelaySeconds: 5
177+
timeoutSeconds: 5
178+
volumeMounts:
179+
- name: git-key
180+
mountPath: /etc/fluxd/ssh # to match location given in image's /etc/ssh/config
181+
readOnly: true # this will be the case perforce in K8s >=1.10
182+
- name: git-keygen
183+
mountPath: /var/fluxd/keygen # to match location given in image's /etc/ssh/config
184+
185+
# Include this if you need to mount a customised known_hosts
186+
# file; you'll also need the volume declared above.
187+
# - name: ssh-config
188+
# mountPath: /root/.ssh
189+
190+
# Include this and the volume "kubeconfig" above, and the
191+
# environment entry "KUBECONFIG" below, to override the config
192+
# used by kubectl.
193+
# - name: kubeconfig
194+
# mountPath: /etc/fluxd/kube
195+
196+
# Include this to point kubectl at a different config; you
197+
# will need to do this if you have mounted an alternate config
198+
# from a configmap, as in commented blocks above.
199+
# env:
200+
# - name: KUBECONFIG
201+
# value: /etc/fluxd/kube/config
202+
203+
# Include this and the volume "gpg-keys" above, and the
204+
# args below.
205+
# - name: gpg-keys
206+
# mountPath: /root/gpg-import
207+
# readOnly: true
208+
209+
# Include this if you want to supply HTTP basic auth credentials for git
210+
# via the `GIT_AUTHUSER` and `GIT_AUTHKEY` environment variables using a
211+
# secret.
212+
# envFrom:
213+
# - secretRef:
214+
# name: flux-git-auth
215+
216+
args:
217+
218+
# If you deployed memcached in a different namespace to flux,
219+
# or with a different service name, you can supply these
220+
# following two arguments to tell fluxd how to connect to it.
221+
# - --memcached-hostname=memcached.default.svc.cluster.local
222+
223+
# Use the memcached ClusterIP service name by setting the
224+
# memcached-service to string empty
225+
- --memcached-service=
226+
227+
# This must be supplied, and be in the tmpfs (emptyDir)
228+
# mounted above, for K8s >= 1.10
229+
- --ssh-keygen-dir=/var/fluxd/keygen
230+
231+
# Replace the following URL to change the Git repository used by Flux.
232+
# HTTP basic auth credentials can be supplied using environment variables:
233+
# https://$(GIT_AUTHUSER):$(GIT_AUTHKEY)@github.com/user/repository.git
234+
- [email protected]:/content-gitops
235+
- --git-branch=master
236+
- --git-path=namespaces,production
237+
- --git-label=flux
238+
239+
240+
# Include these two to enable git commit signing
241+
# - --git-gpg-key-import=/root/gpg-import
242+
# - --git-signing-key=<key id>
243+
244+
# Include this to enable git signature verification
245+
# - --git-verify-signatures
246+
247+
# Tell flux it has readonly access to the repo (default `false`)
248+
# - --git-readonly
249+
250+
# Instruct flux where to put sync bookkeeping (default "git", meaning use a tag in the upstream git repo)
251+
# - --sync-state=git
252+
253+
# Include these next two to connect to an "upstream" service
254+
# (e.g., Weave Cloud). The token is particular to the service.
255+
# - --connect=wss://cloud.weave.works/api/flux
256+
# - --token=abc123abc123abc123abc123
257+
258+
# Enable manifest generation (default `false`)
259+
# - --manifest-generation=false
260+
261+
# Serve /metrics endpoint at different port;
262+
# make sure to set prometheus' annotation to scrape the port value.
263+
- --listen-metrics=:3031
264+
265+
# Optional DNS settings, configuring the ndots option may resolve
266+
# nslookup issues on some Kubernetes setups.
267+
# dnsPolicy: "None"
268+
# dnsConfig:
269+
# options:
270+
# - name: ndots
271+
# value: "1"

0 commit comments

Comments
 (0)