Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sonic image is not working in Kubernetes #309

Open
RomanKlosSecurrency opened this issue Jan 28, 2023 · 1 comment
Open

Sonic image is not working in Kubernetes #309

RomanKlosSecurrency opened this issue Jan 28, 2023 · 1 comment

Comments

@RomanKlosSecurrency
Copy link

Hello,
I have tried to put sonic server in kubernetes. I want my application and sonic server to be located in the same space.
I have got errors pointing me that sonic image does not have some files like /etc/hosts, /etc/hostname, /etc/resolve.conf. Honestly I stopped trying to make it work after that. Exploring the image I saw that no /etc directory is present.

I have tried to build new image from master branch. Got another error on build step:

`[+] Building 48.6s (16/18)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 74B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 71B 0.0s
=> [internal] load metadata for gcr.io/distroless/cc:latest 0.4s
=> [internal] load metadata for docker.io/library/rust:slim-bullseye 0.0s
=> [stage-1 1/3] FROM gcr.io/distroless/cc@sha256:5149ac109a77868790638769902c9b088b429a82c2241a0e88547074be01713a 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 14.74kB 0.0s
=> [build 1/10] FROM docker.io/library/rust:slim-bullseye 0.0s
=> CACHED [stage-1 2/3] WORKDIR /usr/src/sonic 0.0s
=> CACHED [build 2/10] RUN apt-get update 0.0s
=> CACHED [build 3/10] RUN apt-get install -y build-essential clang 0.0s
=> CACHED [build 4/10] RUN rustup --version 0.0s
=> CACHED [build 5/10] RUN rustup component add rustfmt 0.0s
=> CACHED [build 6/10] RUN rustc --version && rustup --version && cargo --version 0.0s
=> CACHED [build 7/10] WORKDIR /app 0.0s
=> CACHED [build 8/10] COPY . /app 0.0s
=> ERROR [build 9/10] RUN cargo clean && cargo build --release --target x86_64-unknown-linux-gnu 48.1s

[build 9/10] RUN cargo clean && cargo build --release --target x86_64-unknown-linux-gnu:
#16 0.478 Updating crates.io index
#16 41.80 Downloading crates ...
#16 42.34 Downloaded log v0.4.17
#16 42.43 Downloaded once_cell v1.15.0
#16 42.45 Downloaded serde v1.0.145
#16 42.49 Downloaded unicode-segmentation v1.10.0
#16 42.51 Downloaded cc v1.0.73
#16 42.52 Downloaded cedarwood v0.4.6
#16 42.52 Downloaded cfg-if v0.1.10
#16 42.59 Downloaded aho-corasick v0.7.19
#16 42.61 Downloaded minimal-lexical v0.2.1
#16 42.61 Downloaded twox-hash v1.6.3
#16 42.64 Downloaded fs_extra v1.2.0
#16 42.68 Downloaded regex-syntax v0.3.9
#16 42.72 Downloaded serde_derive v1.0.145
#16 42.72 Downloaded utf8-ranges v1.0.5
#16 42.72 Downloaded siphasher v0.3.10
#16 42.72 Downloaded peeking_take_while v0.1.2
#16 42.74 Downloaded version_check v0.9.4
#16 42.75 Downloaded autocfg v1.1.0
#16 42.93 Downloaded atty v0.2.14
#16 42.94 Downloaded jobserver v0.1.25
#16 42.96 Downloaded phf_generator v0.11.1
#16 42.97 Downloaded nom v7.1.1
#16 42.98 Downloaded ppv-lite86 v0.2.16
#16 42.99 Downloaded quote v1.0.21
#16 43.01 Downloaded rand_core v0.6.4
#16 43.05 Downloaded regex v1.6.0
#16 43.08 Downloaded strsim v0.10.0
#16 43.08 Downloaded shlex v1.1.0
#16 43.11 Downloaded tikv-jemallocator v0.4.3
#16 43.14 Downloaded toml v0.5.9
#16 43.15 Downloaded syn v1.0.102
#16 43.16 Downloaded ahash v0.7.6
#16 43.22 Downloaded bindgen v0.59.2
#16 43.23 Downloaded bitflags v1.3.2
#16 43.25 Downloaded clang-sys v1.4.0
#16 43.26 Downloaded getrandom v0.2.7
#16 43.26 Downloaded lazy_static v1.4.0
#16 43.27 Downloaded glob v0.3.0
#16 43.27 Downloaded rustc-hash v1.1.0
#16 43.27 Downloaded radix v0.6.0
#16 43.27 Downloaded lazycell v1.3.0
#16 43.27 Downloaded libloading v0.7.3
#16 43.27 Downloaded fxhash v0.2.1
#16 43.33 Downloaded nix v0.18.0
#16 43.33 Downloaded cexpr v0.6.0
#16 43.35 Downloaded proc-macro2 v1.0.47
#16 43.35 Downloaded byteorder v1.4.3
#16 43.36 Downloaded memchr v2.5.0
#16 43.36 Downloaded static_assertions v1.1.0
#16 43.37 Downloaded textwrap v0.15.1
#16 43.38 Downloaded os_str_bytes v6.3.0
#16 43.39 Downloaded rand v0.8.5
#16 43.39 Downloaded phf_codegen v0.11.1
#16 43.39 Downloaded clap_lex v0.2.4
#16 43.40 Downloaded linked-hash-map v0.5.6
#16 43.40 Downloaded phf v0.11.1
#16 43.40 Downloaded phf_shared v0.11.1
#16 43.47 Downloaded termcolor v1.1.3
#16 43.54 Downloaded unicode-ident v1.0.5
#16 43.59 Downloaded clap v3.2.22
#16 43.71 Downloaded memmap v0.6.2
#16 43.71 Downloaded linked_hash_set v0.1.4
#16 43.72 Downloaded rand_chacha v0.3.1
#16 43.73 Downloaded indexmap v1.9.1
#16 43.74 Downloaded rocksdb v0.17.0
#16 43.74 Downloaded cfg-if v1.0.0
#16 43.75 Downloaded smallvec v1.10.0
#16 43.77 Downloaded hashbrown v0.12.3
#16 43.81 Downloaded whatlang v0.16.1
#16 43.82 Downloaded fst-regex v0.3.0
#16 43.82 Downloaded fst-levenshtein v0.3.0
#16 43.88 Downloaded libc v0.2.135
#16 43.92 Downloaded regex-syntax v0.6.27
#16 44.28 Downloaded tikv-jemalloc-sys v0.4.3+5.2.1-patched.2
#16 44.98 Downloaded fst v0.3.5
#16 46.25 Downloaded jieba-rs v0.6.7
#16 47.31 Downloaded librocksdb-sys v6.20.3
#16 47.64 Compiling libc v0.2.135
#16 47.64 Compiling memchr v2.5.0
#16 47.64 Compiling cfg-if v1.0.0
#16 47.64 Compiling proc-macro2 v1.0.47
#16 47.72 error[E0463]: can't find crate for core
#16 47.72 |
#16 47.72 = note: the x86_64-unknown-linux-gnu target may not be installed
#16 47.72 = help: consider downloading the target with rustup target add x86_64-unknown-linux-gnu
#16 47.72
#16 47.72 error[E0463]: can't find crate for compiler_builtins
#16 47.72
#16 47.72 For more information about this error, try rustc --explain E0463.
#16 47.73 error: could not compile cfg-if due to 2 previous errors
#16 47.73 warning: build failed, waiting for other jobs to finish...`

Because of lack of knowledge I could not resolve it.
Is it possible to create new images with Kubernetes support, so it can just work "from the box" ?

@RomanKlosSecurrency RomanKlosSecurrency changed the title Images not working in Kubernetes Sonic image is not working in Kubernetes Jan 28, 2023
@csh0101
Copy link

csh0101 commented Feb 10, 2023

I think there is no problem about k8s.It's only a compile problem? so can I see your DockerFile? it hint your " rustup target add x86_64-unknown-linux-gnu" in your DockerFile. You can also build it prev and Copy the bianry file sonic into the base image which fix your production environment..so if you have problem, we can have a discussion. ps: My English is poor, hope to help you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants