-
-
Save AlexGalhardo/0fe9c7c7e0a35d81fa71dd0a46774eea to your computer and use it in GitHub Desktop.
Scripts e comandos que eu faço no vídeo sobre KinD com Kubernetes: https://www.youtube.com/watch?v=dL19dSGKZoc
This file contains hidden or 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
kind create cluster --name demo-cluster | |
kind get clusters | |
kubectl config get-contexts |
This file contains hidden or 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
kubectl apply -f ./9-deploy.yaml | |
kubectl get pods | |
kubectl logs deploy/api | |
kubectl port-forward service/api 3000:80 |
This file contains hidden or 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
kubectl get namespaces # ou kubectl get ns | |
kubectl get pods -n kube-system |
This file contains hidden or 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
kind delete cluster --name demo-cluster |
This file contains hidden or 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
kind: Cluster | |
apiVersion: kind.x-k8s.io/v1alpha4 | |
node: | |
- role: control-plane | |
- role: worker | |
- role: worker | |
- role: worker |
This file contains hidden or 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
kind create cluster --name demo-cluster-3 --config ./4-kind-3-nodes.yml | |
kind get clusters | |
kubectl config get-contexts | |
kubectl get pods -n kube-system | |
kubectl get nodes |
This file contains hidden or 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
// Crie o arquivo package.json com o comando npm init -y | |
import {createServer} from 'node:http' | |
const server = createServer((r, rs) => { | |
rs.writeHead(200, { 'Content-Type': 'application/json' }) | |
rs.end('Hello') | |
}) | |
server.listen(process.env.PORT || 3000, () => console.log(`Server running on port ${process.env.PORT || 3000}`)) |
This file contains hidden or 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
docker build -t hello-api . | |
docker images |
This file contains hidden or 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
kind load docker-image hello-api --name demo-cluster-3 |
This file contains hidden or 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
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: api | |
spec: | |
selector: | |
matchLabels: | |
app: api | |
template | |
metadata: | |
labels: | |
app: api | |
spec: | |
containers: | |
- name: api | |
image: hello-api | |
imagePullPolicy: IfNotPresent | |
resources: | |
limits: | |
memory: "128Mi" | |
cpu: "500m" | |
ports: | |
- containerPort: 3000 | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: api | |
spec: | |
selector: | |
app: api | |
ports: | |
- port: 80 | |
containerPort: 3000 |
This file contains hidden or 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
FROM node:18-alpine | |
EXPOSE 3000 | |
RUN mkdir /app | |
WORKDIR /app | |
COPY package.json index.mjs /app/ | |
ENTRYPOINT ["node", "index.mjs"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment