mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-09 13:44:24 +00:00
chore: improved readibility
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
# Check a Pod can connect to an external DB
|
||||
|
||||
## Table of contents <!-- omit in toc -->
|
||||
|
||||
1. [TL;DR](#tldr)
|
||||
1. [Further readings](#further-readings)
|
||||
|
||||
## TL;DR
|
||||
|
||||
```sh
|
||||
# access a test container
|
||||
kubectl run --generator=run-pod/v1 --limits 'cpu=200m,memory=512Mi' --requests 'cpu=200m,memory=512Mi' --image alpine ${USER}-mysql-test -it -- sh
|
||||
|
||||
# install programs
|
||||
apk --no-cache add mysql-client netcat-openbsd
|
||||
|
||||
# test plain connectivity
|
||||
nc -vz -w3 10.0.2.15 3306
|
||||
|
||||
# test the client can connect
|
||||
mysql --host 10.0.2.15 --port 3306 --user root
|
||||
```
|
||||
|
||||
## Further readings
|
||||
|
||||
- [Kubernetes]
|
||||
- [`kubectl`][kubectl]
|
||||
|
||||
<!--
|
||||
References
|
||||
-->
|
||||
|
||||
<!-- Knowledge base -->
|
||||
[kubectl]: kubectl.md
|
||||
[kubernetes]: README.md
|
||||
@@ -0,0 +1,40 @@
|
||||
# Check Pods can connect to external DBs
|
||||
|
||||
## Table of contents <!-- omit in toc -->
|
||||
|
||||
1. [TL;DR](#tldr)
|
||||
1. [Further readings](#further-readings)
|
||||
|
||||
## TL;DR
|
||||
|
||||
1. Get a shell on a test container.
|
||||
```sh
|
||||
kubectl run --generator='run-pod/v1' --image 'alpine' -it --rm \
|
||||
--limits 'cpu=200m,memory=512Mi' --requests 'cpu=200m,memory=512Mi' \
|
||||
${USER}-mysql-test -- sh
|
||||
```
|
||||
1. Install the utility applications needed for the tests.
|
||||
```sh
|
||||
apk --no-cache add 'mysql-client' 'netcat-openbsd''
|
||||
```
|
||||
1. Test basic connectivity to the external service.
|
||||
```sh
|
||||
nc -vz -w3 '10.0.2.15' '3306'
|
||||
```
|
||||
1. Test application connectivity.
|
||||
```sh
|
||||
mysql --host '10.0.2.15' --port '3306' --user 'root'
|
||||
```
|
||||
|
||||
## Further readings
|
||||
|
||||
- [Kubernetes]
|
||||
- [`kubectl`][kubectl]
|
||||
|
||||
<!--
|
||||
References
|
||||
-->
|
||||
|
||||
<!-- Knowledge base -->
|
||||
[kubectl]: kubectl.md
|
||||
[kubernetes]: README.md
|
||||
@@ -1,4 +1,4 @@
|
||||
# Drain a K8S cluster node
|
||||
# Drain nodes in K8S clusters
|
||||
|
||||
## Table of contents <!-- omit in toc -->
|
||||
|
||||
@@ -8,14 +8,16 @@
|
||||
|
||||
## TL;DR
|
||||
|
||||
1. mark the node as unschedulable (_cordon_):
|
||||
1. **Cordon** the Nodes.<br/>
|
||||
This marks each Node as _unschedulable_ and prevents new Pods to start on them.
|
||||
|
||||
```sh
|
||||
$ kubectl cordon 'kworker-rj2'
|
||||
node/kworker-rj2 cordoned
|
||||
```
|
||||
|
||||
1. remove pods running on the node:
|
||||
1. **Drain** the nodes.<br/>
|
||||
This _evicts_ Pods already running on the Nodes.
|
||||
|
||||
```sh
|
||||
$ kubectl drain 'kworker-rj2' --grace-period=300 --ignore-daemonsets=true
|
||||
@@ -26,8 +28,9 @@
|
||||
node/kworker-rj2 evicted
|
||||
```
|
||||
|
||||
1. do to the node what you need to do
|
||||
1. make the node available again:
|
||||
1. Do to the Nodes what you need to do.
|
||||
1. **Uncordon** the Nodes.
|
||||
This makes them available for scheduling again.
|
||||
|
||||
```sh
|
||||
$ kubectl uncordon 'kworker-rj2'
|
||||
@@ -16,26 +16,34 @@ helm plugin list
|
||||
helm plugin ls
|
||||
|
||||
# Install new plugins.
|
||||
helm plugin add https://github.com/author/plugin
|
||||
helm plugin install path/to/plugin
|
||||
helm plugin add 'https://github.com/author/plugin'
|
||||
helm plugin install 'path/to/plugin'
|
||||
|
||||
# Update installed plugins.
|
||||
helm plugin update plugin-name
|
||||
helm plugin up plugin-name
|
||||
helm plugin update 'plugin_name'
|
||||
helm plugin up 'plugin_name'
|
||||
|
||||
# Uninstall plugins.
|
||||
helm plugin rm plugin-name
|
||||
helm plugin remove plugin-name
|
||||
helm plugin uninstall plugin-name
|
||||
helm plugin rm 'plugin_name'
|
||||
helm plugin remove 'plugin_name'
|
||||
helm plugin uninstall 'plugin_name'
|
||||
|
||||
# Manage repositories.
|
||||
|
||||
# List added repositories.
|
||||
helm repo list
|
||||
|
||||
# Add repositories.
|
||||
helm repo add 'grafana' 'https://grafana.github.io/helm-charts'
|
||||
helm repo add 'ingress-nginx' 'https://kubernetes.github.io/ingress-nginx'
|
||||
|
||||
# Update repositories.
|
||||
helm repo update
|
||||
helm repo update 'keda'
|
||||
|
||||
# Remove repositories.
|
||||
helm repo remove 'prometheus'
|
||||
|
||||
|
||||
# Search for specific charts
|
||||
helm search hub --max-col-width '100' 'ingress-nginx'
|
||||
helm search repo 'grafana'
|
||||
@@ -50,6 +58,7 @@ helm pull 'ingress-nginx/ingress-nginx' --version '4.0.6' \
|
||||
# Get the default values of specific charts.
|
||||
helm inspect values 'gitlab/gitlab'
|
||||
|
||||
|
||||
# Install releases
|
||||
helm install 'my-gitlab' 'gitlab/gitlab'
|
||||
helm upgrade --install 'my-gitlab' 'gitlab/gitlab'
|
||||
@@ -61,13 +70,13 @@ helm upgrade --install 'keda' 'keda' \
|
||||
--repo 'https://kedacore.github.io/charts' \
|
||||
--namespace 'keda' --create-namespace
|
||||
|
||||
# Upgrade deployed releases
|
||||
# Upgrade deployed releases.
|
||||
helm upgrade --install 'my-wordpress' 'wordpress'
|
||||
helm upgrade --values values.yaml 'my-wordpress' 'wordpress'
|
||||
helm upgrade --values 'values.yaml' 'my-wordpress' 'wordpress'
|
||||
helm upgrade --namespace 'gitlab' --values 'values.yaml' 'gitlab gitlab/gitlab' --dry-run
|
||||
helm upgrade --atomic --create-namespace --namespace 'gitlab' --timeout 0 --values 'values.yaml' 'gitlab' 'gitlab/gitlab' --debug
|
||||
|
||||
# Inspect deployed releases' manifest
|
||||
# Inspect deployed releases' manifests.
|
||||
helm get manifest 'wordpress'
|
||||
```
|
||||
|
||||
@@ -82,12 +91,12 @@ To achieve this:
|
||||
```yaml
|
||||
annotations:
|
||||
meta.helm.sh/release-name: app-release-name
|
||||
meta.helm.sh/release-namespace: app-deploy-namespace-name
|
||||
meta.helm.sh/release-namespace: app-deployment-namespace-name
|
||||
labels:
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
```
|
||||
|
||||
with `app-release-name` being the release name used to deploy the helm chart and `app-deploy-namespace-name` being the deployment namespace
|
||||
with `app-release-name` being the release name used to deploy the helm chart and `app-deployment-namespace-name` being the deployment namespace.
|
||||
|
||||
```sh
|
||||
kubectl annotate "$KIND" "$NAME" "meta.helm.sh/release-name=${RELEASE_NAME}"
|
||||
@@ -95,11 +104,11 @@ To achieve this:
|
||||
kubectl label "$KIND" "$NAME" "app.kubernetes.io/managed-by=Helm"
|
||||
```
|
||||
|
||||
1. add now the existing resources' manifests to the chart
|
||||
1. now, add the existing resources' manifests to the chart
|
||||
1. execute a chart upgrade:
|
||||
|
||||
```sh
|
||||
helm upgrade <app-release-name>
|
||||
helm upgrade 'app-release-name'
|
||||
```
|
||||
|
||||
## Further readings
|
||||
|
||||
Reference in New Issue
Block a user