-Dspring.profiles.active=cloud -Dserver.servlet.context-path=/api/v1 -Dspring.config.location=./bd-spring-module/helm-chart/configs/application-local.yaml
mvn spring-boot:run -Dmaven.multiModuleProjectDirectory=./bd-spring-module -Dspring.config.location=./bd-spring-module/helm-chart/configs/application.yaml
-Dspring.profiles.active=local -Dspring.config.location=bd-spring-module/helm-chart/configs/application-local.yaml
-Dspring.profiles.active=docker -Dspring.config.location=bd-spring-module/helm-chart/configs/application-docker.yaml
-Dspring.profiles.active=k8s -Dspring.config.location=bd-spring-module/helm-chart/configs/application-k8s.yaml
mvn spring-boot:run mvn spring-boot:run -Dspring-boot.run.profiles=azuread
http://localhost:9080/h2-consolehttp://localhost:9080/actuatorhttp://localhost:9080/api-docs
http://localhost:9080/swagger-ui/index.htmlkubectl create ns sb-apps
kubectl label namespace sb-apps istio-injection=enabled
kubectl label namespace sb-apps istio-injection-kubectl -n istio-system delete secret ingress-tls-credential
kubectl -n istio-system create secret tls ingress-tls-credential \
--key=./bd-setup-module/security/server/private/sbhttps.key.pem \
--cert=./bd-setup-module/security/server/certs/sbhttps.cert.pem \
--dry-run=client \
--output=yaml
kubectl -n istio-system get secret ingress-tls-credential --output=yaml
kubectl -n istio-system delete secret ingress-mtls-credential
kubectl -n istio-system create secret generic ingress-mtls-credential \
--from-file=tls.key=./bd-setup-module/security/server/private/sbhttps.key.pem \
--from-file=tls.crt=./bd-setup-module/security/server/certs/sbhttps.cert.pem \
--from-file=ca.crt=./bd-setup-module/security/ca/intermediate/certs/ca-chain.cert.pem \
--dry-run=client \
--output=yaml
kubectl -n istio-system get secret ingress-mtls-credential --output=yaml
helm create ./bd-spring-module/helm-chart --namespace sb-apps#
helm template bd-spring-module ./bd-spring-module/helm-chart \
--namespace=sb-apps \
--set [email protected] \
--set image.pullPolicy=Always \
--set environment=k8s \
--create-namespace=true \
--version=1.0.0 \
--dry-run \
--debug \
--output-dir ./bd-spring-module/helm-chart/manifests
#
helm template bd-spring-module ./bd-spring-module/helm-chart \
--namespace=sb-apps \
--set [email protected] \
--set image.pullPolicy=Always \
--set environment=k8s \
--create-namespace=true \
--version=1.0.0 \
--debug \
> ./bd-spring-module/helm-chart/manifests/bd-spring-module.yaml
#
helm template bd-spring-module ./bd-spring-module/helm-chart/distro/bd-spring-module-0.1.0.tgz \
--namespace=sb-apps \
--set [email protected] \
--set image.pullPolicy=Always \
--version=1.0.0 \
--create-namespace=true \
--debug \
--dry-run \
--output-dir ./bd-spring-module/helm-chart/manifests/
helm package ./bd-spring-module/helm-chart --destination ./bd-spring-module/helm-chart/distrohelm install bd-spring-module ./bd-spring-module/helm-chart \
--namespace=sb-apps \
--set [email protected] \
--set image.pullPolicy=Always \
--set environment=k8s \
--version=1.0.0 \
--create-namespace=true \
--debug \
--dry-run \
> ./bd-spring-module/helm-chart/manifests/bd-spring-module.yaml
#
helm install bd-spring-module ./bd-spring-module/helm-chart/distro/bd-spring-module-0.1.0.tgz \
--namespace=sb-apps \
--set [email protected] \
--set image.pullPolicy=Always \
--set environment=k8s \
--version=1.0.0 \
--create-namespace=true \
--debug \
--dry-run \
> ./bd-spring-module/helm-chart/manifests/bd-spring-module.yaml
helm upgrade bd-spring-module ./bd-spring-module/helm-chart \
--namespace=sb-apps \
--set [email protected] \
--set image.pullPolicy=Always \
--set environment=k8s \
--version=1.0.0 \
--create-namespace=true \
--install \
--debug \
--dry-run \
--output-dir ./bd-spring-module/helm-chart/manifests/helm show values ./bd-spring-module/helm-charthelm get manifest bd-spring-module -n sb-apps > ./bd-spring-module/helm-chart/manifests/bd-spring-module.yamlhelm list --all-namespaces
helm ls --namespace=sb-apps
helm status bd-spring-module --namespace=sb-apps
helm history bd-spring-module --namespace=sb-apps
helm uninstall bd-spring-module --namespace=sb-apps
helm delete bd-spring-module --namespace=sb-appskubectl --namespace=sb-apps get all
kubectl --namespace=sb-apps get pods --show-labels
kubectl --namespace=sb-apps get hpa
export POD_NAME=$(kubectl get pods --namespace sb-apps -l "app.kubernetes.io/name=springboot-app,app.kubernetes.io/instance=bd-spring-module" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace=sb-apps exec -it pod/$POD_NAME -- /bin/bash
helm repo add bd-spring-module https://nexus.repo.com --namespace sb-apps
helm repo update bd-spring-module https://nexus.repo.comkubectl label namespace sb-apps istio-injection=enabled
kubectl label namespace sb-apps istio-injection-kubectl run mysql-client -it --rm --restart=Never --image=mysql:8.0.33 -- /bin/bash -c "mysql --user=root --password=p@SSW0rd --host=mysql-external-svc.sb-apps.svc.cluster.local --database=SANDBOXDB"
kubectl run mysql-client -it --rm --restart=Never --image=mysql:8.0.33 -- /bin/bash -c "mysql --user=root --password=p@SSW0rd --host=mysql-service.sb-apps.svc.cluster.local --database=SANDBOXDB"
kubectl run mysql-client -it --rm --restart=Never --image=mysql:8.0.33 -- /bin/bash -c "mysql --user=root --password=p@SSW0rd --host=mysql-docker.sb-apps.svc.cluster.local --database=SANDBOXDB"
kubectl run curl-client -i --rm --restart=Never --image=dockerqa/curl:ubuntu-trusty -- /bin/sh -c "curl -v http://springboot-app-svc.sb-apps.svc.cluster.local:9080/api/v1/ | grep 'Hello, World'"
kubectl run curl-client -i --rm --restart=Never --image=dockerqa/curl:ubuntu-trusty --command -- curl --silent http://sbhttp.sandbox.net/api/v1/
# Run this in a separate terminal
# so that the load generation continues and you can carry on with the rest of the steps
kubectl run -i --tty load-generator --rm --image=busybox:1.28 --restart=Never -- /bin/sh -c "while sleep 0.01; do wget -q -O- http://springboot-app-svc.sb-apps:9080/api/v1; done"
kubectl --namespace=sb-apps get hpa springboot-app --watch
# Get IP of the ingress service
IP=$(kubectl get services -n istio-system istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
curl -v \
--resolve "sbhttp.sandbox.net:80:${IP}" \
"http://sbhttp.sandbox.net/api/v1/health" | grep 'OK'
curl -v -k \
-HHost:sbhttp.sandbox.net \
--resolve "sbhttp.sandbox.net:80:${IP}" \
"http://sbhttp.sandbox.net/api/v1/home" | grep 'Hello, World'curl -v \
-HHost:sbhttps.sandbox.net \
--resolve sbhttps.sandbox.net:443:${IP} \
--cacert ./bd-setup-module/security/ca/intermediate/certs/ca-chain.cert.pem \
"https://sbhttps.sandbox.net:443/api/v1/home" | grep 'Hello, World'curl -v -k \
-HHost:sbhttps.sandbox.net \
--resolve sbhttps.sandbox.net:443:${IP} \
--cacert ./bd-setup-module/security/ca/intermediate/certs/ca-chain.cert.pem \
"https://sbhttps.sandbox.net:443/api/v1/home" | grep 'Hello, World'curl -v -sI \
-HHost:sbmtls.sandbox.net \
--resolve sbmtls.sandbox.net:443:${IP} \
--cacert ./bd-setup-module/security/ca/intermediate/certs/ca-chain.cert.pem \
--cert ./bd-setup-module/security/client/certs/sbhttps-client.cert.pem \
--key ./bd-setup-module/security/client/private/sbhttps-client.key.pem \
"https://sbmtls.sandbox.net:443/api/v1/home" | grep 'Hello, World'curl -X GET -s \
--cacert ./bd-setup-module/security/ca/intermediate/certs/ca-chain.cert.pem \
--cert ./bd-setup-module/security/client/certs/sbhttps-client.cert.pem \
--key ./bd-setup-module/security/client/private/sbhttps-client.key.pem \
"https://sbmtls.sandbox.net:443/api/v1/home" | grep 'Hello, World'
curl -v -k \
-HHost:sbmtls.sandbox.net \
--resolve sbmtls.sandbox.net:443:${IP} \
--cacert ./bd-setup-module/security/ca/intermediate/certs/ca-chain.cert.pem \
--cert ./bd-setup-module/security/client/certs/sbhttps-client.cert.pem \
--key ./bd-setup-module/security/client/private/sbhttps-client.key.pem \
"https://sbmtls.sandbox.net:443/api/v1/home" | grep 'Hello, World'
for a in {1..1000}; do
curl \
-HHost:sbmtls.sandbox.net \
--resolve sbmtls.sandbox.net:443:${IP} \
--cacert ./bd-setup-module/security/ca/intermediate/certs/ca-chain.cert.pem \
--cert ./bd-setup-module/security/client/certs/sbhttps-client.cert.pem \
--key ./bd-setup-module/security/client/private/sbhttps-client.key.pem \
"https://sbmtls.sandbox.net:443/api/v1/home"| grep 'Hello, World' ;
done;
https://sbhttps.sandbox.net/api/v1/actuator/env
{{ range $index, $service := (lookup "v1" "Service" "mynamespace" "").items }}
{{/* do something with each service */}}
{{ end }}
{{- range $index, $topping := .Values.pizzaToppings }}
{{ $index }}: {{ $topping }}
{{- end }}
#
favorite:
drink: coffee
food: pizza
{{- range $key, $val := .Values.favorite }}
{{ $key }}: {{ $val | quote }}
{{- end }}
{{ (.Files.Glob "configs/*.toml").AsConfig | indent 2 }}
{{- if eq .Values.environment "local" }}
{{- (.Files.Glob "configs/dev/application.yaml").AsConfig | nindent 2 -}}
{{- else if eq .Values.environment "docker" }}
{{- (.Files.Glob "configs/docker/application.yaml").AsConfig | nindent 2 -}}
{{- end }}
#
aapplication.yaml: |- {{ range .Files.Lines "configs/config1.toml" }}
{{ . }}{{ end }}
# kubectl -n istio-system get secret ingress-tls-credential --output='jsonpath={.data.tls\.crt}' | base64 -d
---
apiVersion: v1
kind: Secret
metadata:
name: ingress-tls-credential
namespace: istio-system
type: Opaque
data:
tls.key: {{ .Files.Get "certs/sbhttps.key.pem" | b64enc }}
tls.crt: {{ .Files.Get "certs/sbhttps.cert.pem" | b64enc }}
# kubectl -n istio-system get secret ingress-mtls-credential --output='jsonpath={.data.tls\.crt}' | base64 -d
---
apiVersion: v1
kind: Secret
metadata:
name: ingress-mtls-credential
namespace: istio-system
type: Opaque
data:
tls.key: {{ .Files.Get "certs/sbhttps.key.pem" | b64enc }}
tls.crt: {{ .Files.Get "certs/sbhttps.cert.pem" | b64enc }}
ca.crt: {{ .Files.Get "certs/ca-chain.cert.pem" | b64enc }}kubectl -n istio-system get secret ingress-tls-credential --output='jsonpath={.data.tls\.crt}' | base64 -d
kubectl -n istio-system get secret ingress-mtls-credential --output='jsonpath={.data.tls\.crt}' | base64 -d
kubectl -n sb-apps create secret docker-registry docker-reg-cred --docker-server=https://index.docker.io/v1/ --docker-username=brijeshdhaker --docker-password=Accoo7@k47 [email protected] --dry-run=client --output=yaml
kubectl get secret docker-reg-cred --output="jsonpath={.data.\.dockerconfigjson}" | base64 --decode
kubectl patch serviceaccount default -p '{"imagePullSecrets": [{"name": "docker-reg-cred"}]}'