Kubernetes入门实战
发布日期:2021-05-15 01:32:39 浏览次数:17 分类:精选文章

本文共 4596 字,大约阅读时间需要 15 分钟。

Kubernetes������������

������������������

������������������������������������������������������Kubernetes������������������������minikube������������������������������������������������������

1. ������minikube������

������������������������������minikube���������������������������������������������������

minikube version

���������������

minikube version: v0.25.0

2. ������minikube

������minikube��������������� Kubernetes���������

minikube start

���������������������minikube���������������������������������������kubeconfig������������������������

3. ������������������

������������������������������������������������������kubectl������������������������������

kubectl version

���������������

Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.0", GitCommit:"925c127ec6b946659ad0fd596fa959be43f0cc05", GitTreeState:"clean", BuildDate:"2017-12-15T21:07:38Z", GoVersion:"go1.9.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"", Minor:"", GitVersion:"v1.9.0", GitCommit:"925c127ec6b946659ad0fd596fa959be43f0cc05", GitTreeState:"clean", BuildDate:"2018-01-26T19:04:38Z", GoVersion:"go1.9.1", Compiler:"gc", Platform:"linux/amd64"}

���������Client Version������������kubectl������������������Server Version������������Kubernetes������������������

4. ������������������

���������������������������

kubectl cluster-info

���������������

Kubernetes master is running at https://172.17.0.77:8443

������������������������������IP���������172.17.0.77������������������������������������������������������

kubectl cluster-info dump

5. ������������������

���������������������������������

kubectl get node

���������������

NAME      STATUS    ROLES     AGE       VERSION
host01 Ready
20m v1.9.0

���������ONLY environment������������host01������������master���������node���������

������������������

���������Nginx������������������������kubectl���������Kubernetes���������������������������������������

1. ������Nginx������

������kubectl���������������������Nginx���������

kubectl run first-app --image=nginx:latest --port=80

���������������������������������first-app������������������������Docker Hub������������Nginx������������������������80���

2. ������������������

���������������������

kubectl get deployment

���������������

NAME        DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
first-app 1 1 1 1 1m

3. ������Pod������

������������������Pod���

kubectl get pod

���������������

NAME                        READY     STATUS    RESTARTS   AGE
first-app-6db44b474-dbbtp 1/1 Running 0 4m

4. ������Pod������������

������������������������Pod������������������

kubectl describe pod first-app-6db44b474-dbbtp

������������������Pod������������������������IP���������������������������

������������������

���������������������������������������������������������INGress������������������������Nginx������������������������

1. ������Nginx������

������������������������Nginx���

kubectl expose deployment/first-app --type="NodePort" --port=80

������������������������������first-app���NodePort������������������

2. ������������������

���������������������

kubectl get svc first-app

���������������

NAME        TYPE       CLUSTER-IP    EXTERNAL-IP   PORT(S)        AGE
first-app NodePort 10.102.0.12
80:30491/TCP 1m

NodePort���������������������������IP���������������������������������������������curl���������������

curl 172.17.0.77:30491

������Nginx���������������������������������404 Not Found���������

������������������

���������������������������Kubernetes������������������������������������������������Nginx������������������������

1. ������������������

���������������������������

kubectl scale deployment/first-app --replicas=3

2. ������������������

������������������Pod���������

kubectl get pod

���������3���������������Pod���

������������������

������������������������������������������������������������������������

1. ���������������������������

���������������������������������������������������

curl 172.17.0.77:30491/abc

������������������������Nginx���������1.13.9���

2. ������������������

���������������������

kubectl set image deployment/first-app first-app=nginx:1.10.3

3. ������������������

���������������������������������

curl 172.17.0.77:30491/abc

���������������������������������1.10.3���

������������������

������������������������������������������������������

kubectl delete deployment/first-app

������������Pod���������

kubectl get pod

���������������������Pod������������������������������������������������

上一篇:常用linux的两种主流类型对比
下一篇:JS之JSON.stringify的格式化输出

发表评论

最新留言

哈哈,博客排版真的漂亮呢~
[***.90.31.176]2025年04月14日 03时33分04秒