Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Rancher 2.xMagol K8S, using problem records (continuously updated.)

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

1. Ingress-nginx, modify the default Nginx upload size:

Use Rancher's load balancer to report an error when uploading more than 1m files. Check the ingress-nginx container and discover the configuration.

Client_max_body_size 1m

Solution:

Modify the parameters when creating an ingress:

ApiVersion: extensions/v1beta1kind: Ingressmetadata: annotations: nginx.ingress.kubernetes.io/proxy-body-size: 50m2, K8s use cronjob to back up gitlab automatically

The general situation is to use scheduled tasks to run scripts and run commands.

Gitlab-rake gitlab:backup:create

For gitlab running in K8s, you can use cronjob to run scripts regularly:

1. In order to use kubectl, you need to use kubeconfig. To create a configmap is called kubeconfig:

# kubeconfig is placed on / root/.kube/config by default

Kubectl create configmap kubeconfig-n gitlab-- from-file=/root/.kube/config

2. Create a backup script, configmap:

The backup script is as follows:

#! / bin/sh

Pod_name=$ (kubectl get pods-l app=gitlab-o jsonpath= {.items [*] .metadata.name}-n gitlab-- kubeconfig=/etc/kubeconfig/config)

Kubectl-- kubeconfig=/etc/kubeconfig/config exec $pod_name-n gitlab--gitlab-rake gitlab:backup:create

Import to configmap

3. Mount two configmap, which need to be placed in the corresponding path, kubeconfig in / etc/kubeconfig/config, and backup script in the running path.

4. Configure cronjob to run mounted scripts regularly.

ApiVersion: v1

Items:

ApiVersion: batch/v1beta1

Kind: CronJob

Metadata:

Name: gitlab2-backup

Namespace: gitlab

Spec:

ConcurrencyPolicy: Allow

FailedJobsHistoryLimit: 10

JobTemplate:

Metadata:

CreationTimestamp: null

Spec:

Template:

Metadata:

Spec:

Containers:command:sh/home/demo.sh

Image: lachlanevenson/k8s-kubectl:v1.17.0

ImagePullPolicy: IfNotPresent

Name: gitlab2-backup

Resources: {}

Stdin: true

TerminationMessagePath: / dev/termination-log

TerminationMessagePolicy: File

Tty: true

VolumeMounts:mountPath: / etc/kubeconfig

Name: vol1mountPath: / home

Name: vol2

Volumes:configMap:

DefaultMode: 420

Name: kubeconfig

Optional: false

Name: vol1configMap:

DefaultMode: 493

Name: backup-config

Optional: false

Name: vol2

Schedule: 25 8 *

SuccessfulJobsHistoryLimit: 10

Suspend: false

Kind: List

Metadata:

ResourceVersion: ""

SelfLink: "" 3. Rancher newly added node error report

Runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized

Check and find that there is no configuration file under the new node / etc/cni/net.d/. Just copy the configuration files of other nodes.

10-canal.conflist calico-kubeconfig

Although the node appears normal, the running container reports an error:

Failed create pod sandbox: rpc error: code = Unknown desc = [failed to set up sandbox container "75b6c96ee03bcdb754b01c126afb8f77016000a27e1ad7d55bd4d1e31c7889c4" network for pod "demo1111-645996f944-lrkwq": NetworkPlugin cni failed to set up pod "demo1111-645996f944-lrkwq_yj-test" network: failed to find plugin "loopback" in path [/ opt/cni/bin], failed to clean up sandbox container "75b6c96ee03bcdb754b01c126afb8f77016000a27e1ad7d55bd4d1e31c7889c4" network for pod "demo1111-645996f944-lrkwq": NetworkPlugin cni failed to teardown pod "demo1111-645996f944-lrkwq_yj-test" network: failed to find plugin "portmap" in path [/ opt/cni/bin]] 2 minutes ago

Warning FailedCreatePodSandBox Failed create pod sandbox: rpc error: code = Unknown desc = [failed to set up sandbox container

Check / opt/cni/bin, and sure enough, there are no related files. Copy the other nodes as above.

However, it should not be inexplicably installed. Look at the rancher system project and find that the canal in the kube-system space has not been successfully started in node3. It is slow to pull the image in view. After the mirror image is pulled successfully (I am manually guided), everything is normal.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report