当前位置:   article > 正文

03istio一些初始化的测试及注入pod_pod注册到lstio

pod注册到lstio

一些初始化的测试

[root@node1 ~]# cat /etc/docker/daemon.json 
{
  "registry-mirrors": ["https://n0dwemtq.mirror.aliyuncs.com"]
}
[root@node1 ~]# systemctl daemon-reload
[root@node1 ~]# systemctl restart docker
[root@node1 ~]# ls
grafana.tar  istio-1.6.2.tar  kiali.tar  pilot.1.62.tar  prometheus.tar  proxyv2.tar  tracing.tar
[root@node1 ~]# for i in `ls ` ;do docker load -i $i;done
//因为是单节点部署,我们先把需要的包上传一下(国内网不能直接拉取),再启动下面的命令
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
export PATH=$PATH:/root/istio-1.6.2/bin
istioctl version
  • 1
  • 2
[root@master ~]# istioctl manifest apply --set profile=demo
[root@master ~]# kubectl get all -nistio-system
  • 1
  • 2
[root@master ~]# kubectl edit deployment prometheus -nistio-system
deployment.apps/prometheus edited
        image: docker.io/istio/proxyv2:1.6.2
        imagePullPolicy: IfNotPresent  //如果无法联网,及时修改这里的拉取策略。
  • 1
  • 2
  • 3
  • 4
[root@master ~]# kubectl edit svc istio-ingressgateway  -nistio-system
  type: NodePort
 //这里默认的的service.spec.type字段值为LoadBalancer,需改为NodePort才能正常分配IP
  • 1
  • 2
  • 3
[root@master ~]# kubectl label namespace default istio-injection=enabled
namespace/default labeled     //default命名空间将注入istio
  • 1
  • 2
[root@master ~]# kubectl edit cm  istio-sidecar-injector -nistio-system
configmap/istio-sidecar-injector edited
...
  values: |-
    {
      "global": {
...
        "hub": "docker.io/istio",
        "imagePullPolicy": "IfNotPresent",
  ...修改注入时重新拉取镜像的问题
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
移除

Istio uninstall将分层次删除在Istio -system名称空间下的RBAC权限和所有资源。忽略不存在的资源的错误是安全的,因为它们可能是分层删除的。

istioctl manifest generate --set profile=demo | kubectl delete -f -
  • 1

istio-system的名称空间默认不会删除的,假如不再需要的话,执行如下命令进行删 除。

kubectl delete namespace istio-system
  • 1

第一个istio注入pod

[root@master ~]# cat pod-example.yaml
apiVersion: v1
kind: Pod
metadata:
  name: pod-example
  labels:
    app: myapp
spec:
  containers:
  - name: myos
    image: nginx:latest
    imagePullPolicy: IfNotPresent
    stdin: true
    tty: true
  restartPolicy: Always
[root@master ~]# kubectl get pod
NAME          READY   STATUS    RESTARTS   AGE
pod-example   2/2     Running   0          4s    //使用的是本地的镜像
[root@master ~]# kubectl get pod -owide
NAME          READY   STATUS    RESTARTS   AGE   IP            NODE    NOMINATED NODE   
pod-example   2/2     Running   0          1m   10.244.1.26   node1   <none>         
[root@master ~]# curl 10.244.1.26
<h1>Welcome to nginx!</h1>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/181740
推荐阅读
相关标签
  

闽ICP备14008679号