K8s-training: Difference between revisions
Jump to navigation
Jump to search
m (Tcepo moved page Training k8s to K8s-training without leaving a redirect) |
No edit summary |
||
(42 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
* URL https://appName-nameSpace.wildcardDomain | |||
== YOURS VARS == | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
export wildcardDomain= | |||
</syntaxhighlight> | |||
== DEPLOY == | |||
<syntaxhighlight lang="bash"> | |||
echo "== INIT ENV ==" | |||
export appName=wiki-demo | |||
hostName=${appName}.${wildcardDomain} | |||
appInternalPassword=$(echo -n ${hostName} |base64 -w0 ) | |||
helm repo add bitnami https://charts.bitnami.com/bitnami | |||
mkdir -p ~/old | mkdir -p ~/old | ||
echo "== INFRA ==" | |||
clear | clear | ||
helm template ${appName} bitnami/mediawiki \ | |||
helm template | |||
--set ingress.enabled=true,ingress.hostname=${hostName} \ | --set ingress.enabled=true,ingress.hostname=${hostName} \ | ||
--set | --set mariadb.auth.rootPassword=${appInternalPassword},mariadb.auth.password=${appInternalPassword} \ | ||
--set | --set mediawikiHost=${hostName},mediawikiPassword=${appInternalPassword} |grep -vw namespace |tee ~/old/${hostName}.yaml | ||
echo "== DEPLOY ==" | echo "== DEPLOY ==" | ||
kubectl apply -f ~/old/ | [ ! -z "$(which oc)" ] &&oc get ns |grep default >/dev/null &&oc new-project $wildcardDomain | ||
kubectl apply -f ~/old/${hostName}.yaml | |||
echo "== FIX OPENSHIFT SOLUTION ==" | |||
if [ ! -z "$(which oc)" ] ;then | |||
for sa in $(oc get sa -o jsonpath="{.items[*].metadata.name}") | |||
do | |||
oc adm policy add-scc-to-user privileged -z ${sa} | |||
done | |||
oc create route edge --service=${appName}-mediawiki --hostname=${hostName} 2>/dev/null | |||
fi | |||
echo "== YOURS URL ==" | |||
echo https://${hostName} | |||
</syntaxhighlight> | |||
== DELETE == | |||
kubectl delete -f ~/old/ | <syntaxhighlight lang="bash"> | ||
oc delete route ${appName}-mediawiki 2>/dev/null #FIX OPENSHIFT SOLUTION | |||
kubectl delete -f ~/old/${hostName}.yaml | |||
echo "== DELETE REMAINING DB ==" | echo "== DELETE REMAINING DB ==" | ||
kubectl delete pvc/data | kubectl delete pvc/data-${appName}-mariadb-0 | ||
</syntaxhighlight> | </syntaxhighlight> |
Latest revision as of 20:35, 25 December 2023
YOURS VARS
export wildcardDomain=
DEPLOY
echo "== INIT ENV =="
export appName=wiki-demo
hostName=${appName}.${wildcardDomain}
appInternalPassword=$(echo -n ${hostName} |base64 -w0 )
helm repo add bitnami https://charts.bitnami.com/bitnami
mkdir -p ~/old
echo "== INFRA =="
clear
helm template ${appName} bitnami/mediawiki \
--set ingress.enabled=true,ingress.hostname=${hostName} \
--set mariadb.auth.rootPassword=${appInternalPassword},mariadb.auth.password=${appInternalPassword} \
--set mediawikiHost=${hostName},mediawikiPassword=${appInternalPassword} |grep -vw namespace |tee ~/old/${hostName}.yaml
echo "== DEPLOY =="
[ ! -z "$(which oc)" ] &&oc get ns |grep default >/dev/null &&oc new-project $wildcardDomain
kubectl apply -f ~/old/${hostName}.yaml
echo "== FIX OPENSHIFT SOLUTION =="
if [ ! -z "$(which oc)" ] ;then
for sa in $(oc get sa -o jsonpath="{.items[*].metadata.name}")
do
oc adm policy add-scc-to-user privileged -z ${sa}
done
oc create route edge --service=${appName}-mediawiki --hostname=${hostName} 2>/dev/null
fi
echo "== YOURS URL =="
echo https://${hostName}
DELETE
oc delete route ${appName}-mediawiki 2>/dev/null #FIX OPENSHIFT SOLUTION
kubectl delete -f ~/old/${hostName}.yaml
echo "== DELETE REMAINING DB =="
kubectl delete pvc/data-${appName}-mariadb-0