首页 > 其他分享 >harbor+k8s deploy

harbor+k8s deploy

时间:2024-03-10 11:56:30浏览次数:32  
标签:control Rocky kubernetes deploy harbor name k8s root flannel

install docker

https://docs.docker.com/engine/install/
添加自动补全

yum -y install bash-completion
source /usr/share/bash-completion/bash_completion

install and configuration harbor

[root@Rocky-Harbor certs]# mkdir -pv /k8s/softwares/certs/{ca,server,client}

[root@Rocky-Harbor certs]# tar -zxvf harbor-offline-installer-v2.9.3.tgz

[root@Rocky-Harbor certs]# openssl genrsa -out ca/ca.key 4096

[root@Rocky-Harbor certs]# openssl req -x509 -new -nodes -sha512 -days 3650  -subj "/C=CN/ST=Beijing/L=Beijing/O=example/OU=Personal/CN=foam.com"  -key ca/ca.key  -out ca/ca.crt

[root@Rocky-Harbor certs]# openssl req -x509 -new -nodes -sha512 -days 3650  -subj "/C=CN/ST=Beijing/L=Beijing/O=example/OU=Personal/CN=foam.com"  -key ca/ca.key  -out ca/ca.crt

[root@Rocky-Harbor certs]# openssl genrsa -out server/harbor.foam.com.key 4096

[root@Rocky-Harbor certs]# openssl req -sha512 -new     -subj "/C=CN/ST=Beijing/L=Beijing/O=example/OU=Personal/CN=harbor.foam.com"     -key server/harbor.foam.com.key     -out server/harbor.foam.com.csr

[root@Rocky-Harbor certs]# cat > v3.ext <<-EOF
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth
subjectAltName = @alt_names

[alt_names]
DNS.1=foam.com
DNS.2=foam
DNS.3=harbor.foam.com
EOF

[root@Rocky-Harbor certs]# openssl x509 -req -sha512 -days 3650     -extfile v3.ext     -CA ca/ca.crt -CAkey ca/ca.key -CAcreateserial     -in server/harbor.foam.com.csr     -out server/harbor.foam.com.crt

[root@Rocky-Harbor certs]# openssl x509 -inform PEM -in server/harbor.foam.com.crt -out server/harbor.foam.com.cert

[root@Rocky-Harbor certs]# mkdir -pv /etc/docker/certs.d/harbor.foam.com

[root@Rocky-Harbor certs]# cp -r /k8s/softwares/certs/client/* /etc/docker/certs.d/harbor.foam.com/

[root@Rocky-Harbor certs]# echo ip harbor.foam.com >> /etc/hosts

[root@Rocky-Harbor harbor]# echo alias yy=\'egrep -v \"\^.*#\|\^\$\"\'  >> /root/.bashrc 

[root@Rocky-Harbor harbor]# source /root/.bashrc 

# harbor configuration
hostname: harbor.foam.com
http:
  port: 80
https:
  port: 443
  certificate: /k8s/softwares/certs/server/harbor.foam.com.crt
  private_key: /k8s/softwares/certs/server/harbor.foam.com.key
harbor_admin_password: foam

[root@Rocky-Harbor harbor]# ./install

[root@Rocky-Harbor harbor]# docker login -u admin -p foam harbor.foam.com
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

[root@Rocky-Harbor harbor]# docker logout harbor.foam.com

[root@Rocky-Harbor harbor]# scp /k8s/softwares/certs/client/* 192.168.100.15:/etc/docker/certs.d/harbor.foam.com
[root@Rocky-Harbor harbor]# scp /k8s/softwares/certs/client/* 192.168.100.7:/etc/docker/certs.d/harbor.foam.com
[root@Rocky-Harbor harbor]# scp /k8s/softwares/certs/client/* 192.168.100.8:/etc/docker/certs.d/harbor.foam.com

install kubernetes

# All Node and install docker

[root@Rocky-kubernetes-control ~]# swapoff -a && sysctl -w vm.swappiness=0

[root@Rocky-kubernetes-control ~]# sed -ri '/^[^#]*swap/s@^@#@' /etc/fstab

[root@Rocky-kubernetes-control ~]# ifconfig  eth0  | grep ether | awk '{print $2}'

[root@Rocky-kubernetes-control ~]# cat > /etc/modules-load.d/k8s.conf << EOF
br_netfilter
EOF

[root@Rocky-kubernetes-control ~]# cat > /etc/sysctl.d/k8s.conf << EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF

[root@Rocky-kubernetes-control ~]# sysctl --system

[root@Rocky-kubernetes-control ~]# mkdir -pv /etc/docker/certs.d/harbor.foam.com

[root@Rocky-kubernetes-control ~]# systemctl enable --now docker

[root@Rocky-kubernetes-control ~]# sed -i 's/^SELINUX=enforcing$/SELINUX=disabled/' /etc/selinux/config 

[root@Rocky-kubernetes-control ~]# grep ^SELINUX= /etc/selinux/config

[root@Rocky-kubernetes-control ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.100.15    kubernetes-control
192.168.100.7     kubernetes-node1
192.168.100.8     kubernetes-node2
192.168.100.25    harbor.foam.com

[root@Rocky-kubernetes-control ~]# docker login -u admin -p foam harbor.foam.com

[root@Rocky-kubernetes-control ~]# docker logout harbor.foam.com

# All Node install kubeadm kubelet kubectl

[root@Rocky-kubernetes-control ~]# cat  > /etc/yum.repos.d/kubernetes.repo <<EOF
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=0
repo_gpgcheck=0
EOF

# View kubeadm version
[root@Rocky-kubernetes-control ~]# yum -y list kubeadm --showduplicates | sort -r

# install kubeadm-1.23.17-0
[root@Rocky-kubernetes-control ~]# yum -y install kubeadm-1.23.17-0 kubelet-1.23.17-0 kubectl-1.23.17-0

[root@Rocky-kubernetes-control ~]# kubeadm init --kubernetes-version=v1.23.17 --image-repository registry.aliyuncs.com/google_containers  --pod-network-cidr=10.100.0.0/16 --service-cidr=10.200.0.0/16  --service-dns-domain=foam.com
相关参数说明:
	--kubernetes-version:
		指定K8S master组件的版本号。
		
	--image-repository:
		指定下载k8s master组件的镜像仓库地址。
		
	--pod-network-cidr:
		指定Pod的网段地址。
		
	--service-cidr:
		指定SVC的网段

	--service-dns-domain:
		指定service的域名。若不指定,默认为"cluster.local"

# 输出信息

[init] Using Kubernetes version: v1.23.17
[preflight] Running pre-flight checks
	[WARNING SystemVerification]: this Docker version is not on the list of validated versions: 25.0.3. Latest validated version: 20.10
	[WARNING Hostname]: hostname "rocky-kubernetes-control" could not be reached
	[WARNING Hostname]: hostname "rocky-kubernetes-control": lookup rocky-kubernetes-control on 192.168.100.2:53: no such host
	[WARNING Service-Kubelet]: kubelet service is not enabled, please run 'systemctl enable kubelet.service'
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
[certs] Using certificateDir folder "/etc/kubernetes/pki"
[certs] Generating "ca" certificate and key
[certs] Generating "apiserver" certificate and key
[certs] apiserver serving cert is signed for DNS names [kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.foam.com rocky-kubernetes-control] and IPs [10.200.0.1 192.168.100.15]
[certs] Generating "apiserver-kubelet-client" certificate and key
[certs] Generating "front-proxy-ca" certificate and key
[certs] Generating "front-proxy-client" certificate and key
[certs] Generating "etcd/ca" certificate and key
[certs] Generating "etcd/server" certificate and key
[certs] etcd/server serving cert is signed for DNS names [localhost rocky-kubernetes-control] and IPs [192.168.100.15 127.0.0.1 ::1]
[certs] Generating "etcd/peer" certificate and key
[certs] etcd/peer serving cert is signed for DNS names [localhost rocky-kubernetes-control] and IPs [192.168.100.15 127.0.0.1 ::1]
[certs] Generating "etcd/healthcheck-client" certificate and key
[certs] Generating "apiserver-etcd-client" certificate and key
[certs] Generating "sa" key and public key
[kubeconfig] Using kubeconfig folder "/etc/kubernetes"
[kubeconfig] Writing "admin.conf" kubeconfig file
[kubeconfig] Writing "kubelet.conf" kubeconfig file
[kubeconfig] Writing "controller-manager.conf" kubeconfig file
[kubeconfig] Writing "scheduler.conf" kubeconfig file
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Starting the kubelet
[control-plane] Using manifest folder "/etc/kubernetes/manifests"
[control-plane] Creating static Pod manifest for "kube-apiserver"
[control-plane] Creating static Pod manifest for "kube-controller-manager"
[control-plane] Creating static Pod manifest for "kube-scheduler"
[etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests"
[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s
[kubelet-check] Initial timeout of 40s passed.
[apiclient] All control plane components are healthy after 66.519758 seconds
[upload-config] Storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace
[kubelet] Creating a ConfigMap "kubelet-config-1.23" in namespace kube-system with the configuration for the kubelets in the cluster
NOTE: The "kubelet-config-1.23" naming of the kubelet ConfigMap is deprecated. Once the UnversionedKubeletConfigMap feature gate graduates to Beta the default name will become just "kubelet-config". Kubeadm upgrade will handle this transition transparently.
[upload-certs] Skipping phase. Please see --upload-certs
[mark-control-plane] Marking the node rocky-kubernetes-control as control-plane by adding the labels: [node-role.kubernetes.io/master(deprecated) node-role.kubernetes.io/control-plane node.kubernetes.io/exclude-from-external-load-balancers]
[mark-control-plane] Marking the node rocky-kubernetes-control as control-plane by adding the taints [node-role.kubernetes.io/master:NoSchedule]
[bootstrap-token] Using token: bin8u5.8y2qs46aloky5x8h
[bootstrap-token] Configuring bootstrap tokens, cluster-info ConfigMap, RBAC Roles
[bootstrap-token] configured RBAC rules to allow Node Bootstrap tokens to get nodes
[bootstrap-token] configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials
[bootstrap-token] configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token
[bootstrap-token] configured RBAC rules to allow certificate rotation for all node client certificates in the cluster
[bootstrap-token] Creating the "cluster-info" ConfigMap in the "kube-public" namespace
[kubelet-finalize] Updating "/etc/kubernetes/kubelet.conf" to point to a rotatable kubelet client certificate and key
[addons] Applied essential addon: CoreDNS
[addons] Applied essential addon: kube-proxy

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

Alternatively, if you are the root user, you can run:

  export KUBECONFIG=/etc/kubernetes/admin.conf

You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  https://kubernetes.io/docs/concepts/cluster-administration/addons/

Then you can join any number of worker nodes by running the following on each as root:

kubeadm join 192.168.100.15:6443 --token bin8u5.8y2qs46aloky5x8h \
	--discovery-token-ca-cert-hash sha256:061796f7364225699fc031e8df29a0659e18c716a5209a331efa3ae7b7c91b65 

使用 kubeadm 初始化集群时,可能会出现如下的输出信息

[init] 
	使用初始化的K8S版本。
	
[preflight] 
	主要是做安装K8S集群的前置工作,比如下载镜像,这个时间取决于你的网速。

[certs] 
	生成证书文件,默认存储在"/etc/kubernetes/pki"目录哟。

[kubeconfig]
	生成K8S集群的默认配置文件,默认存储在"/etc/kubernetes"目录哟。

[kubelet-start] 
	启动kubelet,
    环境变量默认写入:"/var/lib/kubelet/kubeadm-flags.env"
    配置文件默认写入:"/var/lib/kubelet/config.yaml"

[control-plane]
	使用静态的目录,默认的资源清单存放在:"/etc/kubernetes/manifests"。
	此过程会创建静态Pod,包括"kube-apiserver","kube-controller-manager"和"kube-scheduler"

[etcd] 
	创建etcd的静态Pod,默认的资源清单存放在:""/etc/kubernetes/manifests"
	
[wait-control-plane] 
	等待kubelet从资源清单目录"/etc/kubernetes/manifests"启动静态Pod。

[apiclient]
	等待所有的master组件正常运行。
	
[upload-config] 
	创建名为"kubeadm-config"的ConfigMap在"kube-system"名称空间中。
	
[kubelet] 
	创建名为"kubelet-config-1.22"的ConfigMap在"kube-system"名称空间中,其中包含集群中kubelet的配置

[upload-certs] 
	跳过此节点,详情请参考”--upload-certs"
	
[mark-control-plane]
	标记控制面板,包括打标签和污点,目的是为了标记master节点。
	
[bootstrap-token] 
	创建token口令,例如:"kbkgsa.fc97518diw8bdqid"。
	如下图所示,这个口令将来在加入集群节点时很有用,而且对于RBAC控制也很有用处哟。

[kubelet-finalize] 
	更新kubelet的证书文件信息

[addons] 
	添加附加组件,例如:"CoreDNS"和"kube-proxy”

Configure all worker nodes to join the k8s cluster

[root@Rocky-kubernetes-node1 ~]# kubeadm join 192.168.100.15:6443 --token bin8u5.8y2qs46aloky5x8h \
        --discovery-token-ca-cert-hash sha256:061796f7364225699fc031e8df29a0659e18c716a5209a331efa3ae7b7c91b65
[preflight] Running pre-flight checks
	[WARNING SystemVerification]: this Docker version is not on the list of validated versions: 25.0.3. Latest validated version: 20.10
	[WARNING Hostname]: hostname "rocky-kubernetes-node1" could not be reached
	[WARNING Hostname]: hostname "rocky-kubernetes-node1": lookup rocky-kubernetes-node1 on 192.168.100.2:53: no such host
	[WARNING Service-Kubelet]: kubelet service is not enabled, please run 'systemctl enable kubelet.service'
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Starting the kubelet
[kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap...

This node has joined the cluster:
* Certificate signing request was sent to apiserver and a response was received.
* The Kubelet was informed of the new secure connection details.

Run 'kubectl get nodes' on the control-plane to see this node join the cluster.

# View existing nodes
[root@Rocky-kubernetes-control ~]# kubectl get nodes
NAME                       STATUS     ROLES                  AGE    VERSION
rocky-kubernetes-control   NotReady   control-plane,master   11m    v1.23.17
rocky-kubernetes-node1     NotReady   <none>                 104s   v1.23.17
rocky-kubernetes-node2     NotReady   <none>                 104s   v1.23.17

[root@Rocky-kubernetes-control ~]# kubectl apply -f kube-flannel.yml 

[root@Rocky-kubernetes-control ~]# kubectl get node
NAME                       STATUS   ROLES                  AGE   VERSION
rocky-kubernetes-control   Ready    control-plane,master   21m   v1.23.17
rocky-kubernetes-node1     Ready    <none>                 12m   v1.23.17
rocky-kubernetes-node2     Ready    <none>                 12m   v1.23.17

# Check if the components are functioning properly
[root@Rocky-kubernetes-control ~]# kubectl get pods -A -o wide| grep kube-flannel
kube-flannel   kube-flannel-ds-6vd59                              1/1     Running   0          5m5s   192.168.100.7    rocky-kubernetes-node1     <none>           <none>
kube-flannel   kube-flannel-ds-c5fdn                              1/1     Running   0          5m5s   192.168.100.8    rocky-kubernetes-node2     <none>           <none>
kube-flannel   kube-flannel-ds-dqjgv                              1/1     Running   0          5m5s   192.168.100.15   rocky-kubernetes-control   <none>           <none>

测试网络连通性

[root@Rocky-kubernetes-control ~]# cat > foam-linux85-ds.yaml << EOF
kind: DaemonSet
apiVersion: apps/v1
metadata:
  name: linux85-ds
spec:
  selector:
    matchLabels:
      school: foam
      class: linux85
  template:
    metadata:
      labels:
        school: foam
        class: linux85
    spec:
      containers:
      - image: alpine
        stdin: true
        name: mylinux
EOF

[root@Rocky-kubernetes-control ~]# kubectl apply -f oldboyedu-linux85-ds.yaml 
daemonset.apps/linux85-ds created

[root@Rocky-kubernetes-control ~]# kubectl get pods -o wide
NAME               READY   STATUS    RESTARTS   AGE   IP           NODE                     NOMINATED NODE   READINESS GATES
linux85-ds-bchtf   1/1     Running   0          11s   10.100.2.3   rocky-kubernetes-node2   <none>           <none>
linux85-ds-sz6mr   1/1     Running   0          57s   10.100.1.2   rocky-kubernetes-node1   <none>           <none>
[root@Rocky-kubernetes-control ~]# kubectl exec  linux85-ds-sz6mr -- ping -c 3  10.100.2.3
PING 10.100.2.3 (10.100.2.3): 56 data bytes
64 bytes from 10.100.2.3: seq=0 ttl=62 time=1.937 ms
64 bytes from 10.100.2.3: seq=1 ttl=62 time=1.310 ms
64 bytes from 10.100.2.3: seq=2 ttl=62 time=0.772 ms

--- 10.100.2.3 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.772/1.339/1.937 ms
[root@Rocky-kubernetes-control ~]# kubectl delete -f foam-linux85-ds.yaml

kubectl TAB

[root@Rocky-kubernetes-control ~]# yum install bash-completion
[root@Rocky-kubernetes-control ~]# source /usr/share/bash-completion/bash_completion
[root@Rocky-kubernetes-control ~]# type _init_completion
[root@Rocky-kubernetes-control ~]# kubectl completion bash | sudo tee /etc/bash_completion.d/kubectl > /dev/null
[root@Rocky-kubernetes-control ~]# sudo chmod a+r /etc/bash_completion.d/kubectl
[root@Rocky-kubernetes-control ~]# echo 'alias k=kubectl' >>~/.bashrc
[root@Rocky-kubernetes-control ~]# echo 'complete -o default -F __start_kubectl k' >>~/.bashrc
[root@Rocky-kubernetes-control ~]# source ~/.bashrc

Kube-flannel file

---
kind: Namespace
apiVersion: v1
metadata:
  name: kube-flannel
  labels:
    k8s-app: flannel
    pod-security.kubernetes.io/enforce: privileged
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  labels:
    k8s-app: flannel
  name: flannel
rules:
- apiGroups:
  - ""
  resources:
  - pods
  verbs:
  - get
- apiGroups:
  - ""
  resources:
  - nodes
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - ""
  resources:
  - nodes/status
  verbs:
  - patch
- apiGroups:
  - networking.k8s.io
  resources:
  - clustercidrs
  verbs:
  - list
  - watch
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  labels:
    k8s-app: flannel
  name: flannel
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: flannel
subjects:
- kind: ServiceAccount
  name: flannel
  namespace: kube-flannel
---
apiVersion: v1
kind: ServiceAccount
metadata:
  labels:
    k8s-app: flannel
  name: flannel
  namespace: kube-flannel
---
kind: ConfigMap
apiVersion: v1
metadata:
  name: kube-flannel-cfg
  namespace: kube-flannel
  labels:
    tier: node
    k8s-app: flannel
    app: flannel
data:
  cni-conf.json: |
    {
      "name": "cbr0",
      "cniVersion": "0.3.1",
      "plugins": [
        {
          "type": "flannel",
          "delegate": {
            "hairpinMode": true,
            "isDefaultGateway": true
          }
        },
        {
          "type": "portmap",
          "capabilities": {
            "portMappings": true
          }
        }
      ]
    }
  net-conf.json: |
    {
      "Network": "10.244.0.0/16", # 修改为自己的
      "Backend": {
        "Type": "vxlan"
      }
    }
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: kube-flannel-ds
  namespace: kube-flannel
  labels:
    tier: node
    app: flannel
    k8s-app: flannel
spec:
  selector:
    matchLabels:
      app: flannel
  template:
    metadata:
      labels:
        tier: node
        app: flannel
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: kubernetes.io/os
                operator: In
                values:
                - linux
      hostNetwork: true
      priorityClassName: system-node-critical
      tolerations:
      - operator: Exists
        effect: NoSchedule
      serviceAccountName: flannel
      initContainers:
      - name: install-cni-plugin
        image: docker.io/flannel/flannel-cni-plugin:v1.4.0-flannel1
        command:
        - cp
        args:
        - -f
        - /flannel
        - /opt/cni/bin/flannel
        volumeMounts:
        - name: cni-plugin
          mountPath: /opt/cni/bin
      - name: install-cni
        image: docker.io/flannel/flannel:v0.24.3
        command:
        - cp
        args:
        - -f
        - /etc/kube-flannel/cni-conf.json
        - /etc/cni/net.d/10-flannel.conflist
        volumeMounts:
        - name: cni
          mountPath: /etc/cni/net.d
        - name: flannel-cfg
          mountPath: /etc/kube-flannel/
      containers:
      - name: kube-flannel
        image: docker.io/flannel/flannel:v0.24.3
        command:
        - /opt/bin/flanneld
        args:
        - --ip-masq
        - --kube-subnet-mgr
        resources:
          requests:
            cpu: "100m"
            memory: "50Mi"
        securityContext:
          privileged: false
          capabilities:
            add: ["NET_ADMIN", "NET_RAW"]
        env:
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: EVENT_QUEUE_DEPTH
          value: "5000"
        volumeMounts:
        - name: run
          mountPath: /run/flannel
        - name: flannel-cfg
          mountPath: /etc/kube-flannel/
        - name: xtables-lock
          mountPath: /run/xtables.lock
      volumes:
      - name: run
        hostPath:
          path: /run/flannel
      - name: cni-plugin
        hostPath:
          path: /opt/cni/bin
      - name: cni
        hostPath:
          path: /etc/cni/net.d
      - name: flannel-cfg
        configMap:
          name: kube-flannel-cfg
      - name: xtables-lock
        hostPath:
          path: /run/xtables.lock
          type: FileOrCreate

标签:control,Rocky,kubernetes,deploy,harbor,name,k8s,root,flannel
From: https://www.cnblogs.com/NingYaFelix/p/18063939

相关文章

  • k8s中命名空间的作用是什么
    namespace是kubernetes系统中的一种非常重要的资源,namespace的主要作用是用来实现多套环境的资源隔离,或者说是多租户的资源隔离。k8s通过将集群内部的资源分配到不同的namespace中,可以形成逻辑上的隔离,以方便不同的资源进行隔离使用和管理。不同的命名空间可以存在同名的资源,命......
  • k8s的组件有哪些,作用分别是什么
    k8s主要由master节点和node节点构成。master节点负责管理集群,node节点是容器应用真正运行的地方。master节点包含的组件有:kube-api-server、kube-controller-manager、kube-scheduler、etcd。node节点包含的组件有:kubelet、kube-proxy、container-runtime。kube-api-server:以......
  • k8s中port-forward 与service的nodeport区别
    在Kubernetes中,port-forward和Service的NodePort是两种将外部流量引入集群内部Pod的方法,但它们在实现方式、使用场景和安全性等方面有所不同。port-forward:实现方式:kubectlport-forward命令允许你将本地机器上的一个端口转发到Kubernetes集群中的一个Pod上的端口。这是一种......
  • 灰度发布、蓝绿部署、金丝雀发布和AB测试及在k8s中的实现
    灰度发布、蓝绿部署、金丝雀发布和AB测试都是软件开发和部署中常用的策略,每种策略都有其特定的用途和优势。下面是对这些策略的简要解释:灰度发布(GrayscaleRelease):灰度发布是一种逐步将新版本软件推向用户的方法。通过逐步增加新版本的使用者数量,开发者可以监控新版本的性能和......
  • Window10使用Docker-Desktop自带k8s和dashboard配置本地k8s开发环境
    安装Docker-DesktopInstallDockerDesktoponWindows下载地址:https://docs.docker.com/desktop/install/windows-install/打开Docker-Desktop,启用Kubernetes打开Docker-Desktop,启用Kubernetes点击左上角:设置,选择Kubernetes选项卡,启用Kubernetes,点击Apply&restart注意:最......
  • Qt开发,报错:Error while building/deploying project untitled (kit: ....)
    1、问题描述 Qt开发,编译时,报错如下:1Cannotfindfile:F:\linux\...\Console.pro.213:49:47:进程"D:\Qt\Qt5.14.2\5.14.2\msvc2017_64\bin\qmake.exe"退出,退出代码2。3Errorwhilebuilding/deployingprojectConsole(kit:DesktopQt5.14.2MSVC201764bit)4......
  • 为什么将Jenkins部署在k8s上
    传统Jenkins的Master-Slave方案的缺陷Master节点发生单点故障时,整个流程都不可用了每个Slave节点的配置环境不一样,来完成不同语言的编译打包等操作,但是这些差异化的配置导致管理起来非常不方便,维护起来也是比较费劲资源分配不均衡,有的Slave节点要运行的job出现排队等待,而有......
  • golang项目用k8s部署的流程
    摘要:本文将详细介绍如何使用Kubernetes(K8S)部署一套Golang微服务项目,并给出了完整的实施步骤和相应代码示例,旨在指导刚入行的开发者完成这一任务。一、整体流程下面是使用K8S部署Golang微服务项目的整体流程,我们将在接下来的内容中详细介绍每一步骤。1.准备容器镜像2.创建K8S集......
  • K8S的HPA原理
    在Kubernetes(简称K8s)中,HorizontalPodAutoscaler(HPA)是一种自动扩展Pod副本数量的机制,其原理是基于集群中运行的应用程序资源使用情况动态调整Pod副本的数量。 HPA的工作原理可以概括为以下几个步骤:监控指标:HPA通过与KubernetesMetricsAPI交互,持续监控指定目标对象(如De......
  • K8S - 配置资源管理
    配置资源管理ConfigMap资源(简称给cm)用于保存配置文件,环境变量等不需要加密的信息。它可以实现将配置信息与应用程序解耦    kubectlrunpod-demo--image=soscscs/myapp--port=80--dry-run=client-oyaml>pod-demo.yaml  kubectlcreatecmcm-de......