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

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:              
Selector:                 run=load-balancer-example
Type:                     NodePort
IP:                       10.254.219.204
Port:                       80/TCP
TargetPort:               80/TCP
NodePort:                   31081/TCP
Endpoints:                172.17.0.2:80
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   
[root@k8s bin]# curl "10.254.219.204:80"



Welcome to nginx!



Welcome to nginx!

If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.

安装完成!

安装步骤

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

你可能感兴趣的:(手动构筑单机版K8s(八)全局验证)