School project to load balance and make some HA on a cluster Kubernetes installed with kubespray-ops project.
) ( ) (
( /( ( )\ ) ( /( * ) )\ )
)\()) ( ( )\ ( (()/( )\())( ` ) /(( (()/(
|((_)\ )\ )((_))\ /(_)|(_)\ )\ ( )(_))\ /(_))
|_ ((_) ((_|(_)_((_)(_)) _((_|(_)(_(_()|(_)(_))
| |/ / | | || _ ) __| _ \| \| | __|_ _| __/ __|
' <| |_| || _ \ _|| /| .` | _| | | | _|\__ \
_|\_\\___/ |___/___|_|_\|_|\_|___| |_| |___|___/
Made by FULCHIC Gaby
kubectl create -f hello-world/
kubectl delete -f hello-world/
kubectl version
kubectl api-versions
kubectl get nodes
kubectl create -f ./gaby-namespace.yaml
kubectl delete namespaces gaby-namespace.yaml
kubectl get namespaces
- with a get pods
kubectl get pods --namespace=gaby
kubectl config view
kubectl config current-context
kubectl config set-context dev --namespace=yournamespace
kubectl config use-context dev
kubectl run test1234 image=library/hello-world --port=XXXX
kubectl get deployments
- with a file
kubectl apply -f deployment.yaml
kubectl expose deployment test1234 --type=LoadBalancer --port=8080 --target-port=8080
kubectl get services
kubectl describe theservice
You can set Labels in yaml file :D.
label:
name: it-prod-apps
With that you can manipulate some services or pods grouping them by their Labels.
kubectl -l name=it-prod-apps get services
You can add quotas by using "resources" in the namespace.yml file. But you also create a file with a kind : ResourceQuota and you gonna create it using :
kubectl create -f ./resourcequota.yml --namespace=namespace
kubectl get quota --namespace=namespace
kubectl describe quota compute-resources-sample --namespace=namespace
- To expose the API kube via a proxy
kubectl proxy --port=8080
curl http://localhost:8080/api/
- Get the pods from default namespaces for example
Hello-world docker with k8s :
kubectl run test1234 --image=library/hello-world --port=8080
Expose it :
kubectl expose deployment test1234 --type=LoadBalancer --port=8080 --target-port=8080
Get the ip exposed, there are 2 commands :
kubectl get svc
kubectl get services
Clean all :
kubectl delete deployment test1234
kubectl delete svc test1234