-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelm commands.txt
284 lines (216 loc) · 10.2 KB
/
helm commands.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
#########################
kubectl get services
#lists all the installations that we have done using helm
helm ls
#########################
#############
#'helm search': Finding Charts
helm search hub wordpress
#add the bitnami repo to the local helm
helm repo add bitnami https://charts.bitnami.com/bitnami
#'helm install': Installing a Package
helm install happy-panda bitnami/wordpress
# To access your WordPress site from outside the cluster,
# Get the WordPress URL by running these commands
#In powershell:
$SERVICE_IP = (kubectl get svc --namespace default happy-panda-wordpress --template "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}")
echo "WordPress URL: http://$SERVICE_IP/"
echo "WordPress Admin URL: http://$SERVICE_IP/admin"
#to get the username:
echo Username: user
#to get the password: (current password: 03wkYUxsyy)
$encodedPassword = kubectl get secret --namespace default happy-panda-wordpress -o jsonpath="{.data.wordpress-password}"
[System.Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($encodedPassword))
#############
##################
#to get the helm data
helm env
#all the helm charts will be saved in "HELM_CACHE_HOME"
##################
##########
helm ls
helm uninstall <helm_chart_name>
##########
#####################
#cd to the folder where you want to create your helm chart
helm create <a_helm_chart_name>
#(To create my custome helm chart)
#i deleted all the files in the templates folder,
#deleted all the data in the values.yaml file,
#and maintained a different appVersion in the Chart.yaml file.
#added the .yaml files from https://github.com/eazybytes/microservices/tree/3.3.2/section_16/helm/eazybank-common/templates
#####################
###########
#created a new folder eazybank-services
#cd to the folder
helm create accounts
#i deleted all the files in the templates folder,
#deleted all the data in the values.yaml file,
#and maintained a different appVersion in the Chart.yaml file.
#added the dependencies in Chart.yaml file (eazybank-common).
#refrenced the common.deployment template in deployment.yaml
#refrenced the common.service template in service.yaml
#added the required data to the values.yaml file
#This will compile helm chart accounts and try to compile all the dependent helm charts and place them in the chart folder
helm dependencies build
###########
#######################
#created an environments folder
#cd into the environments folder
helm create dev-env
#i deleted all the files in the templates folder,
#deleted all the data in the values.yaml file,
#and maintained a different appVersion in the Chart.yaml file.
#added the dependencies in Chart.yaml file
#refrenced the common.configmap template in configmap.yaml
#added the required data to the values.yaml file
#This will compile helm chart accounts and try to compile all the dependent helm charts and place them in the chart folder
helm dependencies build
#######################
###########To get the kubernetes manifest files that are generated by the helm chart###########
#cd into your helm folder (dev-env this time)
helm template .
###########
######################KEYCLOAK with bitnami helm chart######################
#Downloaded all the bitnami helm charts from https://github.com/bitnami/charts
#copied the keycloak helm chart folder to my helm folder
#in values.yaml changed the service to LoadBalancer
#in values.yaml set the adminPassword to password
#CD into the keycloak folder
helm dependencies build
#CD into the helm folder (outer folder)
helm install keycloak keycloak
#to get the URL and port (in powershell):
$env:HTTP_SERVICE_PORT = (kubectl get --namespace default -o jsonpath="{.spec.ports[?(@.name=='http')].port}" services keycloak)
$env:SERVICE_IP = (kubectl get svc --namespace default keycloak -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo "http://$env:SERVICE_IP:$env:HTTP_SERVICE_PORT/"
#to get the username and password (in powershell):
$adminPasswordEncoded = kubectl get secret --namespace default keycloak -o jsonpath="{.data.admin-password}"
$adminPassword = [System.Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($adminPasswordEncoded))
echo "Username: user"
echo "Password: $adminPassword"
#current URL http://localhost/
#current username: user
#current password: password
######################
#########Connect to keycloak-postgresql#########
#From values.yaml get the Username, Database
#to get the password:
#List Secrets in the Namespace
kubectl get secrets -n <NAMESPACE>
#Get the Secret
kubectl get secret <SECRET_NAME> -n <NAMESPACE> -o yaml
#decode the password (powershell)
[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String("PASSWORD"))
#use port-forwarding to connect to the database with DBeaver
kubectl port-forward --namespace default svc/keycloak-postgresql 5444:5432
#########
######################KAFKA with bitnami helm chart######################
#copied the kafka helm chart folder to my helm folder
#in values.yaml set the replicaCount to 1
#in values.yaml changed the SASL_PLAINTEXT protocol to PLAINTEXT (in 4 places)(To reduce the security)
#CD into the kafka folder
helm dependencies build
#CD into the helm folder (outer folder)
helm install kafka kafka
######################
######################PROMETHEUS with bitnami helm chart######################
#copied the kube-prometheus helm chart folder to my helm folder
#to scrape the metrics from the microservices inside the kubernetes cluster
#in values.yaml for additionalScrapeConfigs:
enabled: true
type: internal
#added the internal jobList as we need to provide the details of our microservices so that prometheus can connect with them and read their metrics with the help of actuator prometheus URL
#in internal jobList under additionalScrapeConfigs in values.yaml (this is a jobList entry example):
{
"job_name": "accounts",
"metrics_path": "/actuator/prometheus",
"static_configs": [
{
"targets": ["accounts:8080"]
}
]
}
#the full list can be found here: https://github.com/eazybytes/microservices/blob/3.3.2/section_16/helm/kube-prometheus/values.yaml
#CD into the kube-prometheus folder
helm dependencies build
#CD into the helm folder (outer folder)
helm install prometheus kube-prometheus
#use port-forwarding to access prometheus(make sure that the pod is running):
echo "Prometheus URL: http://127.0.0.1:9090/"
kubectl port-forward --namespace default svc/prometheus-kube-prometheus-prometheus 9090:9090
######################
######################PROMETHEUS changing the configuration######################
#i changed some data inside values.yaml (the indentation was wrong)
#cd into the helm chart folder with the values.yaml file
#helm upgrade prometheus <repository-name>/kube-prometheus -f values.yaml
helm upgrade prometheus bitnami/kube-prometheus -f values.yaml
######################
######################grafana-loki with bitnami helm chart######################
#loki is responsible to aggregate all the logs that are generated by each microservice
#copied the grafana-loki helm chart folder to my helm folder
#didnot change any of the configuration data
#CD into the grafana-loki folder
helm dependencies build
#CD into the helm folder (outer folder)
helm install loki grafana-loki
######################
######################grafana-tempo with bitnami helm chart######################
#copied the grafana-tempo helm chart folder to my helm folder
#in values.yaml enabled http and grpc for otlp so the open telemetry java agent that we have inside the microservices can send the tracing details to the tempo(by default otlp is disabled inside this helm chart)
#CD into the grafana-tempo folder
helm dependencies build
#CD into the helm folder (outer folder)
helm install tempo grafana-tempo
#this value is present in the values.yaml in prod-env to fill the configmap.yaml (in refrence for the grafana-tempo service)
#otelExporterEndPoint: http://tempo-grafana-tempo-distributor:4317
######################
######################grafana######################
#copied the grafana helm chart folder to my helm folder
#in values.yaml in secretDefinition added apiVersion, deleteDatasources and datasources (for Prometheus, Loki, Tempo).
#this added data can be found in https://github.com/eazybytes/microservices/blob/3.3.2/section_16/helm/grafana/values.yaml
#CD into the grafana folder
helm dependencies build
#CD into the helm folder (outer folder)
helm install grafana grafana
** Please be patient while the chart is being deployed **
1. Get the application URL by running these commands:
echo "Browse to http://127.0.0.1:3000"
kubectl port-forward svc/grafana 3000:3000 &
2. Get the admin credentials(in powershell):
$encodedPassword = kubectl get secret grafana-admin --namespace default -o jsonpath="{.data.GF_SECURITY_ADMIN_PASSWORD}"
$password = [System.Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($encodedPassword))
Write-Output "User: admin"
Write-Output "Password: $password"
######################
###########
#to get all the installations or deployments that we have done with helm
helm ls
###########
##################updating values/configuration of a pod##################
#make the required Changes in values.yaml (inside gatewayserver)
#to get all the installations or deployments that we have done with helm
helm ls
#go to prod-env folder then run:
helm dependencies build
#go up one folder
cd ..
#Run the following command to upgrade the gatewayserver chart within the prod-env Helm chart:
helm upgrade eazybank prod-env
#eazybank: This is the name of your Helm release.
#prod-env: helm chart folder
##################
#######################helm history and rollback#######################
#to get the helm history with the revisions of a release(eazybank):
helm history eazybank
#to rollback a release(eazybank) to a specific revision (1):
helm rollback eazybank 1
#######################
#########helm uninstall#########
#to get all the installations/deployments/releases that we have done with helm
helm ls
#to uninstall a deployment/release
helm uninstall <release-name>
#everything gets deleted except Persistent Volume Claims and Persistent Volumes
#make sure to delete the coresponding Persistent Volume Claims so it wouldnot create issues the next time when installing the helm chart.
#########