Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
corso_devops_2018
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Barbara Martelli
corso_devops_2018
Commits
39752fcc
Commit
39752fcc
authored
6 years ago
by
Barbara Martelli
Browse files
Options
Downloads
Patches
Plain Diff
Add new file
parent
14ac2a3c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
minikube tutorial/statements-list.txt
+120
-0
120 additions, 0 deletions
minikube tutorial/statements-list.txt
with
120 additions
and
0 deletions
minikube tutorial/statements-list.txt
0 → 100644
+
120
−
0
View file @
39752fcc
# Get minikube:
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.30.0/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
# Get kubectl
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && chmod +x ./kubectl && mv ./kubectl /usr/local/bin/kubectl
#Config:
echo "`hostname -i` minikube" >> /etc/hosts
# echo “[host eth0 IP] [hostname] [hostname.novalocal]” >> /etc/hosts
#Run:
minikube config set vm-driver none
minikube start
#Verify:
kubectl cluster-info
kubectl get componentstatus
kubectl get nodes
kubectl get pods --all-namespaces
kubectl get deployment --all-namespaces
#Demo kubernetes
minikube version
minikube start
kubectl version
kubectl cluster-info
kubectl get nodes
#Using kubectl to Create a Deployment
#Deploy our app
kubectl run kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1 --port=8080
kubectl get deployments
#View our app
#in a different terminal type:
kubectl proxy
curl http://localhost:8001/version
export POD_NAME=$(kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}'); echo Name of the Pod: $POD_NAME
curl http://localhost:8001/api/v1/namespaces/default/pods/$POD_NAME/proxy/
#Pods and Nodes
#Check application configuration
kubectl get pods
kubectl describe pods
#View the container logs
kubectl logs $POD_NAME
#Executing command on the container
kubectl exec $POD_NAME env
kubectl exec -ti $POD_NAME bash
cat server.js
#You can check that the application is up by running a curl command:
curl localhost:8080
#Note: here we used localhost because we executed the command inside the NodeJS container
#To close your container connection type exit
#Using a Service to Expose Your App
#Create a new service
kubectl get pods
kubectl get services
kubectl expose deployment/kubernetes-bootcamp --type="NodePort" --port 8080
kubectl get services
kubectl describe services/kubernetes-bootcamp
#Create an environment variable called NODE_PORT that has the value of the Node port assigned:
export NODE_PORT=$(kubectl get services/kubernetes-bootcamp -o go-template='{{(index .spec.ports 0).nodePort}}'); echo NODE_PORT=$NODE_PORT
curl $(minikube ip):$NODE_PORT
#Using labels
kubectl describe deployment
kubectl get pods -l run=kubernetes-bootcamp
kubectl get services -l run=kubernetes-bootcamp
kubectl label pod $POD_NAME app=v1
kubectl describe pods $POD_NAME
kubectl get pods -l app=v1
#Deleting a service
kubectl delete service -l run=kubernetes-bootcamp
kubectl get services
curl $(minikube ip):$NODE_PORT
kubectl exec -ti $POD_NAME curl localhost:8080
#Running Multiple Instances of Your App
#Scaling a deployment
kubectl get deployments
kubectl scale deployments/kubernetes-bootcamp --replicas=4
kubectl get deployments
kubectl get pods -o wide
kubectl describe deployments/kubernetes-bootcamp
#Load Balancing
#Ricreo il servizio che prima ho cancellato per esercizio:
kubectl expose deployment/kubernetes-bootcamp --type="NodePort" --port 8080
kubectl describe services/kubernetes-bootcamp
export NODE_PORT=$(kubectl get services/kubernetes-bootcamp -o go-template='{{(index .spec.ports 0).nodePort}}'); echo NODE_PORT=$NODE_PORT
curl $(minikube ip):$NODE_PORT
#Scale Down
kubectl scale deployments/kubernetes-bootcamp --replicas=2
kubectl get deployments
kubectl get pods -o wide
#Performing a Rolling Update
#Update the version of the app
kubectl get deployments
kubectl get pods
kubectl describe pods
kubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=jocatalin/kubernetes-bootcamp:v2
kubectl get pods
#Verify an update
curl $(minikube ip):$NODE_PORT
kubectl rollout status deployments/kubernetes-bootcamp
kubectl describe pods
#Rollback an update
kubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=gcr.io/google-samples/kubernetes-bootcamp:v10
kubectl get deployments
kubectl get pods
kubectl describe pods
kubectl rollout undo deployments/kubernetes-bootcamp
kubectl get pods
kubectl describe pods
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment