美文网首页
手动构筑单机版K8s(八)全局验证

手动构筑单机版K8s(八)全局验证

作者: 贪得_3440 | 来源:发表于2021-07-04 20:52 被阅读0次

8.全局验证

验证测试

创建一个nginx的service试一下集群是否可用

[root@k8s bin]# kubectl run nginx --replicas=1 --labels="run=load-balancer-example" --image=nginx  --port=80
pod "nginx" created
  • k8s 1.18已经不再会创建deployment了,取而代之的是直接创建pod
[root@k8s bin]# kubectl expose pod nginx --type=NodePort --name=example-service
service "example-service" exposed

此时pod已经跑起来了

[root@k8s bin]# kubectl get pods
NAME    READY   STATUS    RESTARTS   AGE
nginx   1/1     Running   1          26h
[root@k8s bin]# kubectl describe svc example-service
Name:                     example-service
Namespace:                default
Labels:                   run=load-balancer-example
Annotations:              <none>
Selector:                 run=load-balancer-example
Type:                     NodePort
IP:                       10.254.219.204
Port:                     <unset>  80/TCP
TargetPort:               80/TCP
NodePort:                 <unset>  31081/TCP
Endpoints:                172.17.0.2:80
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>
[root@k8s bin]# curl "10.254.219.204:80"
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

安装完成!

安装步骤

  1. 事前准备
  2. 创建TLS证书和秘钥
  3. 安装kubectl命令行工具
  4. 创建kubeconfig文件
  5. 创建高可用etcd集群
  6. 部署master节点
  7. 部署node节点
  8. 全局验证

相关文章

网友评论

      本文标题:手动构筑单机版K8s(八)全局验证

      本文链接:https://www.haomeiwen.com/subject/yjwrultx.html