Last active
August 12, 2022 16:02
-
-
Save diegofreitas/6e3dc476c62667696e533a7b60e9beb3 to your computer and use it in GitHub Desktop.
Kubernets Notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://docs.docker.com/engine/install/linux-postinstall/ | |
https://docs.docker.com/engine/install/ubuntu/#installation-methods | |
*Run images locally on minikube | |
https://medium.com/swlh/how-to-run-locally-built-docker-images-in-kubernetes-b28fbc32cc1d | |
Enable local docker images to be visible by minikube | |
minikube start | |
eval $(minikube -p minikube docker-env) | |
kubectl config set-context --current --namespace=openapi | |
docker build should be run in the same console env | |
*create cluster | |
kops create cluster --name=kube.plutto.money --state=s3://kops100k-bucket --zones=sa-east-1a --node-count=2 --node-size=t3.micro --master-size=t3.micro --dns-zone=kube.plutto.money --cloud=aws | |
kops update cluster --name kube.plutto.money --yes --admin | |
ssh -i ~/.ssh/id_rsa ubuntu@api.kube.plutto.money | |
kops validate cluster --wait 10m | |
*deployment | |
kubectl create -f contract-service/kube-local.yml | |
kubectl expose deployment contracts-service --type=Node | |
kubectl get services | |
check health: kops validate cluster | |
* How to update kubectl to see a new Kubernetes cluster | |
https://gist.github.com/jeffjohnson9046/295e7a032b9a910b0f9896e1c432e972 | |
* get correct name of the zones: https://github.com/kubernetes/kops/issues/3784 | |
show info of available items: kubectl get service/pod/deployment | |
show info from moduel: kubectl describe pod contracts-service-5dbbfb79bb-7lxfn | |
execute command in pod(deployed docker): kubectl exec contracts-service-5dbbfb79bb-7lxfn -- ls | |
Port forward to local: kubectl port-forward contracts-service-5dbbfb79bb-7lxfn 8081:8080 | |
Debug: | |
see logs in pod/service: kubectl attach contracts-service-5dbbfb79bb-7lxfn | |
access pod: kubectl run -i --tty busybox --image=busybox --restart=Never | |
Load balance permission: | |
aws iam create-service-linked-role --aws-service-name "elasticloadbalancing.amazonaws.com" | |
create configmap from .properties to be used as env variables | |
kubectl create configmap db-configmap --from-env-file db.properties |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment