This commit is contained in:
Wilfried OLLIVIER 2020-11-16 15:07:27 +01:00
parent b14c8a16b7
commit d558932768
3 changed files with 44 additions and 0 deletions

View File

@ -30,6 +30,8 @@
- [SVN](./dev/tools/svn.md)
- [Ops](./ops/main.md)
- [k8s](./ops/k8s/main.md)
- [kubectl](./ops/k8s/kubectl.md)
- [macOS](./ops/macos/main.md)
- [iterm](./ops/macos/iterm.md)
- [GNU/Linux](./ops/gnulinux/main.md)

41
src/ops/k8s/kubectl.md Normal file
View File

@ -0,0 +1,41 @@
# kubectl
kubectl is the main command line tool for k8s. See [reference](https://kubernetes.io/docs/reference/kubectl/conventions/)
## Raw commands
Sometimes it's handy to just run a container without all the yaml mess.
### Running a container
```sh
kubectl run --image=IMAGE name
```
### apply is not always the answer
Even if you see `kubectl apply` everywhere sometimes it's handy to use dedicated commands
For example, `kubectl create` is used to create a ressource and will throw an error if a ressource already exists.
### Generating a manifests, blazzing fast way
```sh
kubectl run app --image=app --dry-run=client -o yaml
```
```sh
kubectl create deployment --image=redis redis --dry-run=client -o yaml
```
Of course, if you need to write it into a file
```sh
kubectl create deployment --image=redis redis --dry-run=client -o yaml > deploy-manifest.yml
```
### Switching namespaces contexts
```sh
kubectl config set-config $(kubectl config current-context) --namespace=target
```

1
src/ops/k8s/main.md Normal file
View File

@ -0,0 +1 @@
# k8s