You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.2 KiB
Markdown
43 lines
1.2 KiB
Markdown
|
3 years ago
|
# Kubernetes
|
||
|
|
|
||
|
|
- minikube
|
||
|
|
```shell
|
||
|
|
$ minikube start drivers=kvm2
|
||
|
|
|
||
|
|
$ minikube status
|
||
|
|
|
||
|
|
```
|
||
|
|
|
||
|
|
- kubectl
|
||
|
|
```shell
|
||
|
|
# create jenkins namespace
|
||
|
|
$ kubectl create namespace jenkins
|
||
|
|
|
||
|
|
# list existing namespaces
|
||
|
|
$ kubectl get namespaces
|
||
|
|
```
|
||
|
|
|
||
|
|
- Port forwarding
|
||
|
|
|
||
|
|
```shell
|
||
|
|
# Listen on port 8888 locally, forwarding to 5000 in the pod
|
||
|
|
kubectl port-forward pod/mypod 8888:5000
|
||
|
|
|
||
|
|
# Listen on port 8888 on all addresses, forwarding to 5000 in the pod
|
||
|
|
kubectl port-forward --address 0.0.0.0 pod/mypod 8888:5000
|
||
|
|
|
||
|
|
# Listen on a random port locally, forwarding to 5000 in the pod
|
||
|
|
kubectl port-forward pod/mypod :5000
|
||
|
|
|
||
|
|
# Listen on port 8888 on localhost and selected IP, forwarding to 5000 in the pod
|
||
|
|
kubectl port-forward --address localhost,10.19.21.23 pod/mypod 8888:5000
|
||
|
|
|
||
|
|
# Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in the pod
|
||
|
|
kubectl port-forward pod/mypod 5000 6000
|
||
|
|
|
||
|
|
# Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the deployment
|
||
|
|
kubectl port-forward deployment/mydeployment 5000 6000
|
||
|
|
|
||
|
|
# Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the service
|
||
|
|
kubectl port-forward service/myservice 5000 6000
|
||
|
|
```
|