# Kubernetes Intro
###### tags: `slides`
- Local Google cloud setup
- Tools
---
#### Setup
- Install google SDK:
https://cloud.google.com/sdk/docs/install
region -> (europe-west4-a)
- Install kubectl:
https://kubernetes.io/docs/tasks/tools/
---
- List available clusters in our account
```
gcloud container clusters list
```
- List our available contexts
```
kubectl config get-contexts
```
- Add one cluster to our available contexts
```
gcloud container clusters get-credentials acceptance
```
---
- Change context
```
kubectl config use-context acceptance
```
- List contexts
```
kubectl config get-contexts -o=name
```
- Tool to fancy navigate through contexts:
https://github.com/ahmetb/kubectx#kubectl-plugins-macos-and-linux
---
#### Namespace
- List namespaces
```
kubectl get namespaces
```
- Change namespace
```
kubectl config set-context --current --namespace=equalture-8828728
```
---
- Fancy namespaces navigation
```
kubens
```
```
(I think it is installed with kubectx)
```
---
---
#### kube-ps1
Allows to easily know in which cluster and namespace you are
```
https://github.com/jonmosco/kube-ps1
```
![](https://i.imgur.com/ibTV5PM.png)
---
#### Basic steps
```
kubectl get pods
```
```
kubectl get services
```
```
kubectl get cronjobs
```
----
#### Check logs
```
kubectl get pods
```
```
kubectl logs <pod-name>
```
```
kubectl logs -f <pod-name>
```
---
#### k9s
```
https://github.com/derailed/k9s
```
![](https://i.imgur.com/uB0qoIB.png)
---
#### Check secrets
- All secrets file for current
```
kubectl get secrets
```
- Applying base64 decoding
```
kubectl get secrets jerry-google-cloud-credentials -o json | jq '.data | map_values(@base64d)'
```
- Edit secrets:
```
kubectl edit secrets jerry-google-cloud-credentials
```
---
#### Cluster debugging
```
kubectl get events
```
---
# End
![](https://media.giphy.com/media/3orifhw6nbyAzOx0pW/giphy.gif)
{"metaMigratedAt":"2023-06-16T15:09:12.321Z","metaMigratedFrom":"Content","title":"Kubernetes Intro","breaks":true,"contributors":"[{\"id\":\"23397e98-077f-4fa6-94ec-d8ed5fbb59af\",\"add\":2884,\"del\":965}]"}