地址1:https://pan.baidu.com/s/1eAgrPWfwwSklX7Z12yI1qQ 提取码: drmd 地址2:https://share.weiyun.com/2pn97By4 密码:c58ghh
CKA认证难吗?考试内容有哪些?这个应该是很多准备考CKA认证的学员想问的问题。那么我们今天就针对这个进行详细的讲解。
CKA认证全称是 Certificated Kubernetes Administrator,也就是官方认证的 Kubernetes 管理员,由 Kubernetes 的管理机构 CNCF 授权。
CKA认证考试的题目全部是实操题,没有任何一个选择题或者填空题之类的,而且经常听学员反馈考点设备的网络较卡,设备反应慢等问题,考试环境中需要你自己动手把所有的实操题全部完成才行,所以对于没有基础的学员来说还是有难度的。
考试内容涵盖了k8s的方方面面,包括应用的生命周期管理,网络,存储以及运维等……具体可以看cncf官网里的考试指南。
以下是代码实战:
在common中引入的坐标依赖
String articleKey = "article:" + id;
String articleKeyRedis = "REDIS_ARTICLE:" + id;
Article article = cache.get(articleKey, s -> {
System.out.println("文章id为"+id+"的没有查询到,则从Redis中查询后返回...");
Article articleReal = null;
String articleJsonStr = redis.get(articleKeyRedis);
// 判断从redis中查询到的文章数据是否为空
if (StringUtils.isBlank(articleJsonStr)) {
System.out.println("Redis中不存在该文章,将从数据库中查询...");
// 如果为空,则进入本条件,则从数据库中查询数据
articleReal = articleService.queryArticleDetail(id);
// 手动把文章数据设置到redis中,后续再次查询则有值
String articleJson = JsonUtils.objectToJson(articleReal);
redis.set(articleKeyRedis, articleJson);
} else {
System.out.println("Redis中存在该文章,将直接返回...");
// 如果不为空,则直接转换json类型article再返回即可
articleReal = JsonUtils.jsonToPojo(articleJsonStr, Article.class);
}
return articleReal;
});
return article;
} -- 通过lua脚本,获得一个数组中的所有string类型数据和所有number类型数据, -- 如果不是string和number,则作为其他数据类型 -- 最终把这3种类型的数据,作为array进行输出
function getInnerArray(arr) strArr = {}; numArr = {}; otherArr = {};
for index,value in ipairs(arr) do
-- print(index, value);
if ("string" == type(value)) then
table.insert(strArr, value);
elseif ("number" == type(value)) then
table.insert(numArr, value);
else
table.insert(otherArr, value);
end
end
totalArray = {};
table.insert(totalArray, strArr);
table.insert(totalArray, numArr);
table.insert(totalArray, otherArr);
return totalArray;
end
local temp = {"123", "abc", "xyz", 456, 789, 1010, true, false, {"x", 100}}; totalArray = getInnerArray(temp); -- print(totalArray);
print("===== 打印 strArr ====="); for index,value in ipairs(totalArray[1]) do print(index,value) end
print("===== 打印 numArr ====="); for index,value in ipairs(totalArray[2]) do print(index,value) end
print("===== 打印 otherArr ====="); for index,value in ipairs(totalArray[3]) do print(index,value) end 根据每次请求的url地址,hash后访问到固定的服务器节点。 -- 引入本地缓存article_cache local local_cache = ngx.shared.article_cache;
local args = ngx.req.get_uri_args(); local articleId = args["id"]; local articleKey = "REDIS_ARTICLE:" .. articleId;
local local_article = local_cache:get(articleKey); ngx.log(ngx.ERR, "ngx本地缓存local_article: ", local_article);
-- 本地缓存不为空,直接返回article if local_article ~= nil then ngx.say("by openresty local 106: " .. local_article); return; end
-- 本地缓存为空,则进入redis
if local_article == nil then
ngx.log(ngx.ERR, "ngx本地缓存为空, 将从redis中获得... ");
local articleDetail = redis.get(articleKey);
if articleDetail ~= ngx.null then
ngx.say("by openresty 106: " .. articleDetail);
-- 再设置进本地字典
local_cache:set(articleKey, articleDetail, 5);
return;
end
end
因为发送Ajax请求的时候,前端项目先做数据验证,这就离不开验证函数。在/src/utils目录中创建validate.ts文件,然后定义若干验证函数。
注意事项
1、CKA认证考试题每1-2年变更小范围一次,但考察的内容和题基本是固定的,只要将每道题做熟,并理解,通过基本没有问题
2、英文不好的同学,可以选择中文考试,由于是国外考试,所以网络环境很重要,早上6点-9点网速比较快,要提前做好测试。
3、考试时可以访问kubernets官网查找资料,因为是外网,如果无法访问,准备个科学上网。
4、考试时监考老师要检查证件和室内环境,选择中文考试的同学可持护照或信用卡进行检查。
5、考试环境有多个k8s集群,要切换到要求的环境中进行答题。
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
const history = createWebHistory();
const routes : Array
{
path: '/mis',
name: 'Main',
component: () => import('../views/mis/main.vue'),
children: [
]
},
{
path: '/mis/login',
name: 'MisLogin',
component: () => import('../views/mis/login.vue')
},
{
path: '/404',
name: '404',
component: () => import('../views/404.vue')
},
{
path: '/:pathMatch(.*)*',
redirect: '/404'
}
]; const router = createRouter({ history, routes });
router.beforeEach((to, from, next) => { let permissions = localStorage.getItem('permissions'); let token = localStorage.getItem('token'); let fullPath = to.fullPath; if (fullPath.startsWith('/mis') && fullPath != '/mis/login') { if (permissions == null || permissions == '' || token == null || token == '') { next({ name: 'MisLogin' }); } else { return next(); } } else if (fullPath.startsWith('/front/customer') || fullPath.startsWith('/front/goods_snapshot')) { if (token == null || token == '') { next({ name: 'FrontIndex' }); } else { return next(); } } else { return next(); } });
export default router;