K8s/Run: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
(Created page with "==References== {| | valign="top" | * Helm » Prometheus Stack * Helm » Cert Manager * Helm » Prometheus * Helm » PostgreSQL * Helm » SonarQube * Helm » Grafana * Helm » Jenkins * Helm » GitLab * Helm » MinIO * Helm | valign="top" | * Helm » Camunda * Helm/Keycloak|Helm...")
 
 
(40 intermediate revisions by the same user not shown)
Line 1: Line 1:
{|
|valign="top"|
<syntaxhighlight lang="bash">
export KUBECONFIG="${HOME}/.kube/lke-dev-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/gke-uat-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/eks-pro-kubeconfig.yaml"
</syntaxhighlight>
|valign="top"|
<syntaxhighlight lang="bash">
export KUBECONFIG="${HOME}/.kube/config"
kubectl config get-contexts
kubectl cluster-info
</syntaxhighlight>
|valign="top"|
<syntaxhighlight lang="bash">
kubectl get ns|grep swiss-knife
kubectl delete ns  swiss-knife
kubectl create ns  swiss-knife
</syntaxhighlight>
|}
==Run==
===Run » PSQL===
<syntaxhighlight lang="bash">
kubectl -n swiss-knife run -i --tty --rm psql --image=alpine --restart=Never -- sh
echo -n password: ;read -s PGPASSWORD;export PGPASSWORD;echo
apk --update add postgresql-client inetutils-telnet
psql -d postgres -U postgres -h postgresql.postgresql
</syntaxhighlight>
===Run » Infinity===
<syntaxhighlight lang="bash">
kubectl -n swiss-knife run infinity --image=alpine -- sleep infinity
kubectl -n swiss-knife exec -it infinity -- sh
apk --update add inetutils-telnet
</syntaxhighlight>
===Run » Redis CLI===
<syntaxhighlight lang="bash">
kubectl -n swiss-knife run -i --tty --rm redis-cli --image=alpine --restart=Never -- sh
echo -n password: ;read -s REDISCLI_AUTH;export REDISCLI_AUTH;echo
apk --update add redis inetutils-telnet
echo 'ping'|redis-cli -h redis-headless.redis
</syntaxhighlight>
===Run » MinIO CLI===
<syntaxhighlight lang="bash">
kubectl -n swiss-knife run -i --tty --rm minio-cli --image=alpine --restart=Never -- sh
apk --update add minio-client inetutils-telnet
mcli alias set  k8s_gitlab_aa http://minio.minio:9000 Tnen3kCv71osfJKkhcIP rxMU6fWayQD6no1p1LO7orBmxNMtbKuyHITpflBJ
mcli admin info k8s_gitlab_aa
mcli alias set  k8s_gitlab_ab http://minio.minio:9000 FfG564tLdSlgaM2t0ig0 FEbThROKMZ06Feddr1SUMk85g4wRM5NZnVVrS24V
mcli admin info k8s_gitlab_ab
mcli alias set  s3_host_ab http://s3.host.k8s.local O2PLF0Pznp12HNbT9FbJ YIISq1Srxf9gv24fxkryN5ilQDg8P5wxJXt1qgle
mcli admin info s3_host_ab
mcli alias set  s3_host_aa http://s3.host.k8s.local 6zXMWye9rOjKgpka pHKjpqiXK4RLpvdyX7qYuwbIk5KAkKa6
mcli admin info s3_host_aa
mcli alias set  k8s_admin http://minio.minio:9000 admin sadaqah!
mcli admin info k8s_admin
</syntaxhighlight>
==Playground==
{|
| valign="top" |
<syntaxhighlight lang="bash">
kubectl -n swiss-knife delete pods minio-cli
kubectl -n swiss-knife delete pods redis-cli
</syntaxhighlight>
| valign="top" |
<syntaxhighlight lang="bash">
kubectl -n swiss-knife delete pods infinity
kubectl -n swiss-knife delete pods psql
</syntaxhighlight>
| valign="top" |
<syntaxhighlight lang="bash">
kubectl -n swiss-knife run infinity --image=alpine -- sleep infinity
kubectl -n swiss-knife run ubuntu  --image=ubuntu -- sleep infinity
</syntaxhighlight>
| valign="top" |
|-
| colspan="3" |
----
|-
| valign="top" |
| valign="top" |
| valign="top" |
|}
==References==
==References==
{|
{|
Line 39: Line 144:


| valign="top" |
| valign="top" |
* [https://stackoverflow.com/questions/71043168/ K8s » Attache a Volume to Pod Container]
* [https://stackoverflow.com/questions/23929235/ Bash » Multi-line String With Indentation]
* [https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/ K8s » <code>kubectl rollout</code>]
* [https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/ K8s » <code>kubectl rollout</code>]
* [[K8s/CSI Hostpath Driver|K8s » CSI Hostpath Driver]]
* [[K8s/CSI Hostpath Driver|K8s » CSI Hostpath Driver]]
* [[K8s/Swiss Knife|K8s » Swiss Knife]]
* [[K8s/Ingress|K8s » Ingress]]
* [[K8s/Ingress|K8s » Ingress]]
* [[K8s/Service|K8s » Service]]
* [[MinIO]]
* [[MinIO]]
* [[CIDR]]
* [[CIDR]]
Line 47: Line 156:


| valign="top" |
| valign="top" |
* [https://stackoverflow.com/questions/31870222  K8s » <code>kubectl run</code> » <code>sleep infinity</code>]


|}
|}

Latest revision as of 09:30, 7 September 2024

export KUBECONFIG="${HOME}/.kube/lke-dev-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/gke-uat-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/eks-pro-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/config"
kubectl config get-contexts
kubectl cluster-info
kubectl get ns|grep swiss-knife
kubectl delete ns   swiss-knife
kubectl create ns   swiss-knife

Run

Run » PSQL

kubectl -n swiss-knife run -i --tty --rm psql --image=alpine --restart=Never -- sh
echo -n password: ;read -s PGPASSWORD;export PGPASSWORD;echo
apk --update add postgresql-client inetutils-telnet

psql -d postgres -U postgres -h postgresql.postgresql

Run » Infinity

kubectl -n swiss-knife run infinity --image=alpine -- sleep infinity
kubectl -n swiss-knife exec -it infinity -- sh
apk --update add inetutils-telnet

Run » Redis CLI

kubectl -n swiss-knife run -i --tty --rm redis-cli --image=alpine --restart=Never -- sh
echo -n password: ;read -s REDISCLI_AUTH;export REDISCLI_AUTH;echo
apk --update add redis inetutils-telnet

echo 'ping'|redis-cli -h redis-headless.redis

Run » MinIO CLI

kubectl -n swiss-knife run -i --tty --rm minio-cli --image=alpine --restart=Never -- sh
apk --update add minio-client inetutils-telnet

mcli alias set  k8s_gitlab_aa http://minio.minio:9000 Tnen3kCv71osfJKkhcIP rxMU6fWayQD6no1p1LO7orBmxNMtbKuyHITpflBJ
mcli admin info k8s_gitlab_aa

mcli alias set  k8s_gitlab_ab http://minio.minio:9000 FfG564tLdSlgaM2t0ig0 FEbThROKMZ06Feddr1SUMk85g4wRM5NZnVVrS24V
mcli admin info k8s_gitlab_ab

mcli alias set  s3_host_ab http://s3.host.k8s.local O2PLF0Pznp12HNbT9FbJ YIISq1Srxf9gv24fxkryN5ilQDg8P5wxJXt1qgle
mcli admin info s3_host_ab

mcli alias set  s3_host_aa http://s3.host.k8s.local 6zXMWye9rOjKgpka pHKjpqiXK4RLpvdyX7qYuwbIk5KAkKa6
mcli admin info s3_host_aa

mcli alias set  k8s_admin http://minio.minio:9000 admin sadaqah!
mcli admin info k8s_admin

Playground

kubectl -n swiss-knife delete pods minio-cli
kubectl -n swiss-knife delete pods redis-cli
kubectl -n swiss-knife delete pods infinity
kubectl -n swiss-knife delete pods psql
kubectl -n swiss-knife run infinity --image=alpine -- sleep infinity
kubectl -n swiss-knife run ubuntu   --image=ubuntu -- sleep infinity

References