
k8s
文章平均质量分 64
lijian965644856
这个作者很懒,什么都没留下…
展开
-
cka-真题之查看节点notReady的原因
lijian@lijian2:~$ sudo -i[sudo] password for lijian:root@lijian2:~# docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESf58dbc755099 bfe3a36ebd25 "/coredns -conf /...原创 2021-02-16 18:17:51 · 475 阅读 · 0 评论 -
cka真题之提取pod中的日志到指定文件
Monitor the logs of podbarand:Extract log lines corresponding to errorunable-to-access-websiteWrite them to/opt/KUTR00101/barroot@lijian:~/k8s# cd /opt/root@lijian:/opt# lltotal 20drwxr-xr-x 5 root root 4096 Feb 15 22:09 ./drwxr-xr-x 2...原创 2021-02-16 16:15:36 · 442 阅读 · 0 评论 -
cka真题之---创建pvc给指定pod挂载
Create a newPersistentVolumeClaim:Name:pv-volume Class:csi-hostpath-sc Capacity:10MiCreate a new Pod which mounts thePersistentVolumeClaimas a volume:Name:web-server Image:nginx Mount path:/usr/share/nginx/htmlConfigure the new Pod to ha...原创 2021-02-16 15:20:07 · 1019 阅读 · 0 评论 -
cka真题之-----创建pv
创建一个名为app-config的PV,PV的容量为2Gi访问模式为ReadWriteMany,volume的类型为hostPath,位置为/src/app-configroot@lijian:~/k8s# kubectl describe PersistentVolume app-configName: app-configLabels: <none>Annotations: <none>Finalizers: ...原创 2021-02-16 14:24:25 · 249 阅读 · 0 评论 -
创建有4个容器的指定pod
Create a pod namedkucc8with a single app container for each of the following images running inside (there may be between 1 and 4 images specified):nginx + redis + memcached + consul .root@lijian:~/k8s# cat 4pod.ymlapiVersion: v1kind: Podmetadata:...原创 2021-02-15 22:45:26 · 183 阅读 · 0 评论 -
cka真题之查找ready的node个数
Check to see how many nodes are ready (not including nodes taintedNoSchedule)and write the number to/opt/KUSC00402/kusc00402.txt.查找ready状态的nodekubectl get nodes|grep -i ready|wc -l3kubectl describe nodes |grep -i SchedulingDisabled| grep -i ta...原创 2021-02-15 22:35:27 · 369 阅读 · 0 评论 -
将pod调度到指定的node上
Schedule a pod as follows:name:nginx-kusc00401Image:nginxNode selector:disk-spinning如下:root@lijian:~/k8s# cat pod.ymlapiVersion: v1kind: Podmetadata: name: nginx-kusc00401spec: containers: - name: nginx image: nginx:latest no...原创 2021-02-15 22:05:17 · 418 阅读 · 0 评论 -
cka真题之---网络策略
Create a newNetworkPolicynamedallow-port-from-namespaceto allow Pods in the existing namespaceinternalto connect to port8080of other Pods in the same namespace.Ensure that the new NetworkPolicy:doesnotallow access to Pods not listening on port...原创 2021-02-15 15:48:01 · 1131 阅读 · 1 评论 -
cka真题之-master节点版本升级
Given an existing Kubernetes cluster running version 1.18.8,upgrade all of Kubernetes control plane and node componentson the master node onlyto version 1.19.0。You are also expected to upgrade kubelet and kubectl on the master node。Be sure to drain ..原创 2021-02-15 15:09:53 · 536 阅读 · 0 评论 -
cka真题之数据备份与还原
先安装etcdctl工具:https://github.com/etcd-io/etcd/releases/tag/v3.4.0上传到虚拟机并解压root@lijian:~/k8s/data/backup# cd /root/root@lijian:~# cd etcd/root@lijian:~/etcd# pwd/root/etcdroot@lijian:~/etcd#root@lijian:~/etcd# pwd/root/etcdroot@lijian:~/etcd#.原创 2021-02-15 14:02:45 · 294 阅读 · 0 评论 -
2021三十夜晚用ubuntu18.04搭建k8s1.18.8
kubeadm join 192.168.1.101:6443 --token tkajci.hrpqvfer1jsbkm78 \ --discovery-token-ca-cert-hash sha256:3186a65a44a9132d0bc70272749df32240273e3af6b12d16aeaa7dc81b9c0018已成功 明天整理命令原创 2021-02-13 14:06:29 · 546 阅读 · 0 评论 -
cka真题-创建指定的ingress
题目:创建ingress 名字为pong 命名空间为ing-internal同时在路径/hi用服务端口5678暴露服务hi创建名命空间kubectl create namespace int-internal创建yml文件touch pong-ingress.yml文件内容:apiVersion: networking.k8s.io/v1kind: Ingressmetadata: name: pong namespace: int-internal ann...原创 2021-02-06 11:21:21 · 412 阅读 · 0 评论 -
pod的重启方法
//先将复制因子置为0[root@k8s1 ~]# kubectl scale deployment nginx-deployment --replicas=0 -n defaultdeployment.apps/nginx-deployment scaled[root@k8s1 ~]# kubectl get podsNo resources found in default namespace.[root@k8s1 ~]# kubectl get pods -o wideNo reso..原创 2021-02-04 22:15:25 · 795 阅读 · 0 评论 -
cka真题--将指定的pod设置为不可用并将其上的pod驱散部署到其他节点
[root@k8s1 ~]# kubectl cordon k8s3node/k8s3 cordoned [root@k8s1 ~]# kubectl drain k8s3 --delete-local-data --ignore-daemonsets --forcenode/k8s3 already cordonedWARNING: ignoring DaemonSet-managed Pods: kube-system/kube-flannel-ds-2jc4w, kube-syste...原创 2021-02-04 22:08:02 · 327 阅读 · 0 评论 -
cka-真题RBAC
Task:创建一个名为deployment-clusterrole的clusterrole,并且对该clusterrole只绑定对Deployment,Daemonset,Statefulset的创建权限 在指定namespace app-team1创建一个名为cicd-token的serviceaccount,并且将上一步创建clusterrole和该serviceaccount绑定题目解释: 1,touch deployment-clusterrole.ymlvideploy...原创 2021-02-01 21:50:30 · 536 阅读 · 10 评论 -
从零开始学习K8s之kubeadm搭建V1.19.4版本的k8s
1,虚拟机准备: vmware基于CentOS Linux release 7.9.2009 (Core)搭建三台虚拟机 内核与操作系统版本号: 192.168.1.2/192.168.1.3/192.168.1.4 配置本地虚拟机可以上网:三台机器的网卡配置分别如下192.168.1.2 192.168.1.3 192.168.1.4 配置完后重启网络 systemctl restart network...原创 2021-01-17 17:21:04 · 1894 阅读 · 2 评论 -
centos7.6离线安装kubectl 客户端
公司内网访问不了google 可以采用下面的方式:浏览器中访问https://storage.googleapis.com/kubernetes-release/release/stable.txt得到的最新的稳定版本,但是我们需要的版本是1.13.9,之后在浏览器中访问https://storage.googleapis.com/kubernetes-release/release/v1.13...原创 2020-05-08 16:15:44 · 889 阅读 · 0 评论