1. 我是皮皮虾首页
  2. 网站部署

k8s部署之验证集群(五)

一、创建一个资源配置清单nginx容器
在hdss7-21或hdss7-22任意一个节点上创建一个资源配置清单

cat > /root/nginx-deploy.yaml <<'eof'
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: my-nginx
spec:
  selector:
    matchLabels:
      app: my-nginx
  template:
    metadata:
      labels:
        app: my-nginx
    spec:
      containers:
      - name: my-nginx
        image: harbor.od.com/public/nginx:v1.7.9
        ports:
        - containerPort: 80
eof
[root@hdss-7-22 ~]# kubectl apply -f nginx-deploy.yaml 
daemonset.apps/my-nginx created
[root@hdss-7-22 ~]# kubectl get pod
NAME             READY   STATUS              RESTARTS   AGE
my-nginx-g86bg   0/1     ContainerCreating   0          7s
my-nginx-wx468   0/1     ContainerCreating   0          7s

二、集群检查
在hdss7-21 curl 172.7.21.2

[root@hdss-7-22 ~]# kubectl get pods -o wide
NAME             READY   STATUS    RESTARTS   AGE     IP           NODE                NOMINATED NODE   READINESS GATES
my-nginx-894jh   1/1     Running   0          3m31s   172.7.21.2   hdss7-21.host.com   <none>           <none>
my-nginx-hgctn   1/1     Running   0          3m32s   172.7.22.2   hdss7-22.host.com   <none>           <none>
[root@hdss-7-22 ~]# curl 172.7.22.2
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
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>


在hdss7-22 curl 172.7.22.2

原创文章,作者:站长,如若转载,请注明出处:https://wsppx.cn/1800/%e7%bd%91%e7%ab%99%e9%83%a8%e7%bd%b2/

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注