harbor+k8s deploy

这篇具有很好参考价值的文章主要介绍了harbor+k8s deploy。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

install docker

https://docs.docker.com/engine/install/
添加自动补全文章来源地址https://www.toymoban.com/news/detail-838146.html

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

到了这里,关于harbor+k8s deploy的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Gitlab+Jenkins+Docker+Harbor+K8s集群搭建CICD平台(持续集成部署Hexo博客Demo)

    目录 涉及内容: 一、CICD服务器环境搭建 1、docker 环境安装 (1)、拉取镜像,启动并设置开机自启 (2)、配置docker加速器 2、安装并配置GitLab (1)、创建共享卷目录 (2)、创建 gitlab 容器 (3)、关闭容器修改配置文件 (4)、修改完配置文件之后。直接启动容器 (5)、相关

    2024年03月15日
    浏览(74)
  • 新版K8s:v1.28拉取Harbor仓库镜像以及本地镜像(docker弃用改用containerd,纯纯踩坑)

    使用Kuboard作为k8s集群的管理平台,Harbor作为镜像仓库,拉取Harbor镜像仓库的镜像运行。 从K8s1.24版本之后,k8s就逐渐弃用了docker,采用containerd来管理,这个很重要。 服务器 IP地址 备注 K8sMaster 192.168.2.138 kuboard,Master管理节点 K8sWorker01 192.168.2.139 Worker工作节点 K8sWorker02 192.168.

    2024年01月20日
    浏览(63)
  • k8s创建deployment

    在自定义ns中,使用create命令的方式创建一个3副本的deploy,镜像httpd:latest,端口自定义 2、查看deploy、rs、pod 3、两种方法,扩充副本数量为5 4、变更镜像版本 5、使用yaml文件生成deploy,要求同1 6、升级业务应用,通过变更镜像的方式 7、查看滚动升级的状态 8、查看升级历史

    2024年02月12日
    浏览(78)
  • k8s学习-Deployment

    Kubernetes通过各种Controller来管理Pod的生命周期 。 为了满足不同业 务 景 , Kubernetes 开发了Deployment、ReplicaSet、DaemonSet、StatefuleSet、Job等多种Controller。我们⾸先学习最常用Deployment。 第一种是通过kubectl命令直接创建: 在最新的 Kubernetes 版本中,kubectl create deployment 命令不再直接

    2024年01月19日
    浏览(46)
  • k8s概念-deployment

    deployment用于部署无状态应用 Deployment集成了上线部署、滚动升级、创建副本、回滚等功能 Deployment里包含并使用了ReplicaSet Replicaset 通过改变Pod副本数量实现Pod的扩容和缩容 参考文档  https://kubernetes.io/zh-cn/docs/concepts/workloads/controllers/deployment/ 1 yaml文件 2 pod版本升级 查看帮助

    2024年02月14日
    浏览(42)
  • k8s中的deployment

            Deployment是k8s中用来管理发布的控制器,在开发的过程中使用非常频繁,本篇文章主要介绍deployment相关的使用和原理。 声明式API 最终一致性 水平触发 资源对象 。。。 定义一组pod的期望数量,controller会维持Pod的数量和期望的一致(其实deployment是通过管理rs的状态来

    2024年02月16日
    浏览(35)
  • K8S deployment挂载

     Deployment部署文件 nginx容器页面目录挂载到emptyDir emptyDir目录是pod所在的node节点主机的目录,此目录下的data即对应容器里的/usr/share/nginx/html,实现目录挂载;图1红框里的号对应docker 的name中的编号,如下俩个图

    2024年02月12日
    浏览(39)
  • k8s服务部署核心流程:以Jenkins为核心,从Gitee拉取代码,然后进行maven构建,之后使用docker命令打镜像,并推送镜像到harbor仓库,之后远程调用k8s命令创建服务

    前提是我们在自己电脑上模拟整个流程。 假设我们需要搭建一主一从的k8s集群,那就需要安装VMvare和Centos7(点击我查看安装文档), 然后就可以在这两个虚拟机上搭建k8s集群了(点击我查看安装文档), 一个最简单的devops流程已经在标题中写明了, 其中可以搭建gitlab(点

    2024年02月02日
    浏览(61)
  • k8s之Deployment篇

    Deployment官方文档: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/ Deployment是kubernetes中最常用的资源对象,为ReplicaSet和Pod的创建提供了一种声明式的定义方法,在Deployment对象中描述一个期望的状态,Deployment控制器就会按照一定的控制速率把实际状态改成期望状态,通

    2024年02月05日
    浏览(39)
  • K8S:kubeadm搭建K8S+Harbor 私有仓库

    主机名及主机大小 主机ip 安装软件 master(2C/4G,cpu核心数要求大于2) 192.168.245.113 docker、kubeadm、kubelet、kubectl、flannel node01(2C/2G) 192.168.245.114 docker、kubeadm、kubelet、kubectl、flannel node02(2C/2G) 192.168.245.115 docker、kubeadm、kubelet、kubectl、flannel Harbor节点(hub.blue.com) 192.168.245

    2024年02月09日
    浏览(53)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包