手動(dòng)構(gòu)筑單機(jī)版K8s(八)全局驗(yàn)證

8.全局驗(yàn)證

驗(yàn)證測試

創(chuàng)建一個(gè)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已經(jīng)不再會(huì)創(chuàng)建deployment了,取而代之的是直接創(chuàng)建pod
[root@k8s bin]# kubectl expose pod nginx --type=NodePort --name=example-service
service "example-service" exposed

此時(shí)pod已經(jīng)跑起來了

[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 >nginx.org</a>.<br/>
Commercial support is available at
<a >nginx.com</a>.</p>

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

安裝完成!

安裝步驟

  1. 事前準(zhǔn)備
  2. 創(chuàng)建TLS證書和秘鑰
  3. 安裝kubectl命令行工具
  4. 創(chuàng)建kubeconfig文件
  5. 創(chuàng)建高可用etcd集群
  6. 部署master節(jié)點(diǎn)
  7. 部署node節(jié)點(diǎn)
  8. 全局驗(yàn)證
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容